diff options
Diffstat (limited to 'fpdfsdk')
-rw-r--r-- | fpdfsdk/fpdftext.cpp | 18 | ||||
-rw-r--r-- | fpdfsdk/fpdftext_embeddertest.cpp | 6 |
2 files changed, 13 insertions, 11 deletions
diff --git a/fpdfsdk/fpdftext.cpp b/fpdfsdk/fpdftext.cpp index 85dc6e475e..bc86c1c099 100644 --- a/fpdfsdk/fpdftext.cpp +++ b/fpdfsdk/fpdftext.cpp @@ -205,22 +205,24 @@ FPDF_EXPORT int FPDF_CALLCONV FPDFText_CountRects(FPDF_TEXTPAGE text_page, return textpage->CountRects(start, count); } -FPDF_EXPORT void FPDF_CALLCONV FPDFText_GetRect(FPDF_TEXTPAGE text_page, - int rect_index, - double* left, - double* top, - double* right, - double* bottom) { +FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFText_GetRect(FPDF_TEXTPAGE text_page, + int rect_index, + double* left, + double* top, + double* right, + double* bottom) { if (!text_page) - return; + return false; CPDF_TextPage* textpage = CPDFTextPageFromFPDFTextPage(text_page); CFX_FloatRect rect; - textpage->GetRect(rect_index, rect.left, rect.top, rect.right, rect.bottom); + bool result = textpage->GetRect(rect_index, &rect); + *left = rect.left; *top = rect.top; *right = rect.right; *bottom = rect.bottom; + return result; } FPDF_EXPORT int FPDF_CALLCONV FPDFText_GetBoundedText(FPDF_TEXTPAGE text_page, diff --git a/fpdfsdk/fpdftext_embeddertest.cpp b/fpdfsdk/fpdftext_embeddertest.cpp index 6885eb0f75..a9637be5df 100644 --- a/fpdfsdk/fpdftext_embeddertest.cpp +++ b/fpdfsdk/fpdftext_embeddertest.cpp @@ -115,7 +115,7 @@ TEST_F(FPDFTextEmbeddertest, Text) { right = 0.0; bottom = 0.0; top = 0.0; - FPDFText_GetRect(textpage, 1, &left, &top, &right, &bottom); + EXPECT_TRUE(FPDFText_GetRect(textpage, 1, &left, &top, &right, &bottom)); EXPECT_NEAR(20.847, left, 0.001); EXPECT_NEAR(135.167, right, 0.001); EXPECT_NEAR(96.655, bottom, 0.001); @@ -126,7 +126,7 @@ TEST_F(FPDFTextEmbeddertest, Text) { right = -1.0; bottom = -1.0; top = -1.0; - FPDFText_GetRect(textpage, -1, &left, &top, &right, &bottom); + EXPECT_FALSE(FPDFText_GetRect(textpage, -1, &left, &top, &right, &bottom)); EXPECT_EQ(0.0, left); EXPECT_EQ(0.0, right); EXPECT_EQ(0.0, bottom); @@ -136,7 +136,7 @@ TEST_F(FPDFTextEmbeddertest, Text) { right = -2.0; bottom = -2.0; top = -2.0; - FPDFText_GetRect(textpage, 2, &left, &top, &right, &bottom); + EXPECT_FALSE(FPDFText_GetRect(textpage, 2, &left, &top, &right, &bottom)); EXPECT_EQ(0.0, left); EXPECT_EQ(0.0, right); EXPECT_EQ(0.0, bottom); |