OLD | NEW |
1 // Copyright 2016 PDFium Authors. All rights reserved. | 1 // Copyright 2016 PDFium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
6 | 6 |
7 #include "core/fpdfapi/render/cpdf_imagerenderer.h" | 7 #include "core/fpdfapi/render/cpdf_imagerenderer.h" |
8 | 8 |
| 9 #include <algorithm> |
9 #include <memory> | 10 #include <memory> |
10 | 11 |
11 #include "core/fpdfapi/page/cpdf_docpagedata.h" | 12 #include "core/fpdfapi/page/cpdf_docpagedata.h" |
12 #include "core/fpdfapi/page/cpdf_image.h" | 13 #include "core/fpdfapi/page/cpdf_image.h" |
13 #include "core/fpdfapi/page/cpdf_imageobject.h" | 14 #include "core/fpdfapi/page/cpdf_imageobject.h" |
14 #include "core/fpdfapi/page/cpdf_page.h" | 15 #include "core/fpdfapi/page/cpdf_page.h" |
15 #include "core/fpdfapi/page/cpdf_pageobject.h" | 16 #include "core/fpdfapi/page/cpdf_pageobject.h" |
16 #include "core/fpdfapi/page/cpdf_shadingpattern.h" | 17 #include "core/fpdfapi/page/cpdf_shadingpattern.h" |
17 #include "core/fpdfapi/page/cpdf_tilingpattern.h" | 18 #include "core/fpdfapi/page/cpdf_tilingpattern.h" |
18 #include "core/fpdfapi/parser/cpdf_array.h" | 19 #include "core/fpdfapi/parser/cpdf_array.h" |
(...skipping 30 matching lines...) Expand all Loading... |
49 if (m_DeviceHandle) | 50 if (m_DeviceHandle) |
50 m_pRenderStatus->m_pDevice->CancelDIBits(m_DeviceHandle); | 51 m_pRenderStatus->m_pDevice->CancelDIBits(m_DeviceHandle); |
51 } | 52 } |
52 | 53 |
53 bool CPDF_ImageRenderer::StartLoadDIBSource() { | 54 bool CPDF_ImageRenderer::StartLoadDIBSource() { |
54 CFX_FloatRect image_rect_f = m_ImageMatrix.GetUnitRect(); | 55 CFX_FloatRect image_rect_f = m_ImageMatrix.GetUnitRect(); |
55 FX_RECT image_rect = image_rect_f.GetOuterRect(); | 56 FX_RECT image_rect = image_rect_f.GetOuterRect(); |
56 if (!image_rect.Valid()) | 57 if (!image_rect.Valid()) |
57 return false; | 58 return false; |
58 | 59 |
59 int dest_width = image_rect.Width(); | 60 int dest_width = |
60 int dest_height = image_rect.Height(); | 61 m_ImageMatrix.a >= 0 ? image_rect.Width() : -image_rect.Width(); |
61 if (m_ImageMatrix.a < 0) | 62 int dest_height = |
62 dest_width = -dest_width; | 63 m_ImageMatrix.d <= 0 ? image_rect.Height() : -image_rect.Height(); |
63 if (m_ImageMatrix.d > 0) | |
64 dest_height = -dest_height; | |
65 if (m_Loader.Start( | 64 if (m_Loader.Start( |
66 m_pImageObject, m_pRenderStatus->m_pContext->GetPageCache(), m_bStdCS, | 65 m_pImageObject, m_pRenderStatus->m_pContext->GetPageCache(), m_bStdCS, |
67 m_pRenderStatus->m_GroupFamily, m_pRenderStatus->m_bLoadMask, | 66 m_pRenderStatus->m_GroupFamily, m_pRenderStatus->m_bLoadMask, |
68 m_pRenderStatus, dest_width, dest_height)) { | 67 m_pRenderStatus, dest_width, dest_height)) { |
69 m_Status = 4; | 68 m_Status = 4; |
70 return true; | 69 return true; |
71 } | 70 } |
72 return false; | 71 return false; |
73 } | 72 } |
74 | 73 |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
218 m_pDIBSource = pDIBSource; | 217 m_pDIBSource = pDIBSource; |
219 m_FillArgb = bitmap_argb; | 218 m_FillArgb = bitmap_argb; |
220 m_BitmapAlpha = bitmap_alpha; | 219 m_BitmapAlpha = bitmap_alpha; |
221 m_ImageMatrix = *pImage2Device; | 220 m_ImageMatrix = *pImage2Device; |
222 m_Flags = flags; | 221 m_Flags = flags; |
223 m_bStdCS = bStdCS; | 222 m_bStdCS = bStdCS; |
224 m_BlendType = blendType; | 223 m_BlendType = blendType; |
225 return StartDIBSource(); | 224 return StartDIBSource(); |
226 } | 225 } |
227 | 226 |
| 227 bool CPDF_ImageRenderer::NotDrawing() const { |
| 228 return m_pRenderStatus->m_bPrint && |
| 229 !(m_pRenderStatus->m_pDevice->GetRenderCaps() & FXRC_BLEND_MODE); |
| 230 } |
| 231 |
| 232 FX_RECT CPDF_ImageRenderer::GetDrawRect() const { |
| 233 FX_RECT rect = m_ImageMatrix.GetUnitRect().GetOuterRect(); |
| 234 rect.Intersect(m_pRenderStatus->m_pDevice->GetClipBox()); |
| 235 return rect; |
| 236 } |
| 237 |
| 238 CFX_Matrix CPDF_ImageRenderer::GetDrawMatrix(const FX_RECT& rect) const { |
| 239 CFX_Matrix new_matrix = m_ImageMatrix; |
| 240 new_matrix.TranslateI(-rect.left, -rect.top); |
| 241 return new_matrix; |
| 242 } |
| 243 |
| 244 void CPDF_ImageRenderer::CalculateDrawImage(CFX_FxgeDevice* pBitmapDevice1, |
| 245 CFX_FxgeDevice* pBitmapDevice2, |
| 246 const CFX_DIBSource* pDIBSource, |
| 247 CFX_Matrix* pNewMatrix, |
| 248 const FX_RECT& rect) const { |
| 249 CPDF_RenderStatus bitmap_render; |
| 250 bitmap_render.Initialize(m_pRenderStatus->m_pContext, pBitmapDevice2, nullptr, |
| 251 nullptr, nullptr, nullptr, nullptr, 0, |
| 252 m_pRenderStatus->m_bDropObjects, nullptr, true); |
| 253 CPDF_ImageRenderer image_render; |
| 254 if (image_render.Start(&bitmap_render, pDIBSource, 0xffffffff, 255, |
| 255 pNewMatrix, m_Flags, true, FXDIB_BLEND_NORMAL)) { |
| 256 image_render.Continue(nullptr); |
| 257 } |
| 258 if (m_Loader.m_MatteColor == 0xffffffff) |
| 259 return; |
| 260 int matte_r = FXARGB_R(m_Loader.m_MatteColor); |
| 261 int matte_g = FXARGB_G(m_Loader.m_MatteColor); |
| 262 int matte_b = FXARGB_B(m_Loader.m_MatteColor); |
| 263 for (int row = 0; row < rect.Height(); row++) { |
| 264 uint8_t* dest_scan = |
| 265 const_cast<uint8_t*>(pBitmapDevice1->GetBitmap()->GetScanline(row)); |
| 266 const uint8_t* mask_scan = pBitmapDevice2->GetBitmap()->GetScanline(row); |
| 267 for (int col = 0; col < rect.Width(); col++) { |
| 268 int alpha = *mask_scan++; |
| 269 if (!alpha) { |
| 270 dest_scan += 4; |
| 271 continue; |
| 272 } |
| 273 int orig = (*dest_scan - matte_b) * 255 / alpha + matte_b; |
| 274 *dest_scan++ = std::min(std::max(orig, 0), 255); |
| 275 orig = (*dest_scan - matte_g) * 255 / alpha + matte_g; |
| 276 *dest_scan++ = std::min(std::max(orig, 0), 255); |
| 277 orig = (*dest_scan - matte_r) * 255 / alpha + matte_r; |
| 278 *dest_scan++ = std::min(std::max(orig, 0), 255); |
| 279 dest_scan++; |
| 280 } |
| 281 } |
| 282 } |
| 283 |
228 bool CPDF_ImageRenderer::DrawPatternImage(const CFX_Matrix* pObj2Device) { | 284 bool CPDF_ImageRenderer::DrawPatternImage(const CFX_Matrix* pObj2Device) { |
229 if (m_pRenderStatus->m_bPrint && | 285 if (NotDrawing()) { |
230 !(m_pRenderStatus->m_pDevice->GetRenderCaps() & FXRC_BLEND_MODE)) { | |
231 m_Result = false; | 286 m_Result = false; |
232 return false; | 287 return false; |
233 } | 288 } |
234 FX_RECT rect = m_ImageMatrix.GetUnitRect().GetOuterRect(); | 289 |
235 rect.Intersect(m_pRenderStatus->m_pDevice->GetClipBox()); | 290 FX_RECT rect = GetDrawRect(); |
236 if (rect.IsEmpty()) | 291 if (rect.IsEmpty()) |
237 return false; | 292 return false; |
238 | 293 |
239 CFX_Matrix new_matrix = m_ImageMatrix; | 294 CFX_Matrix new_matrix = GetDrawMatrix(rect); |
240 new_matrix.TranslateI(-rect.left, -rect.top); | |
241 int width = rect.Width(); | |
242 int height = rect.Height(); | |
243 CFX_FxgeDevice bitmap_device1; | 295 CFX_FxgeDevice bitmap_device1; |
244 if (!bitmap_device1.Create(rect.Width(), rect.Height(), FXDIB_Rgb32, nullptr)) | 296 if (!bitmap_device1.Create(rect.Width(), rect.Height(), FXDIB_Rgb32, nullptr)) |
245 return true; | 297 return true; |
246 | 298 |
247 bitmap_device1.GetBitmap()->Clear(0xffffff); | 299 bitmap_device1.GetBitmap()->Clear(0xffffff); |
248 CPDF_RenderStatus bitmap_render; | 300 CPDF_RenderStatus bitmap_render; |
249 bitmap_render.Initialize(m_pRenderStatus->m_pContext, &bitmap_device1, | 301 bitmap_render.Initialize(m_pRenderStatus->m_pContext, &bitmap_device1, |
250 nullptr, nullptr, nullptr, nullptr, | 302 nullptr, nullptr, nullptr, nullptr, |
251 &m_pRenderStatus->m_Options, 0, | 303 &m_pRenderStatus->m_Options, 0, |
252 m_pRenderStatus->m_bDropObjects, nullptr, true); | 304 m_pRenderStatus->m_bDropObjects, nullptr, true); |
253 CFX_Matrix patternDevice = *pObj2Device; | 305 CFX_Matrix patternDevice = *pObj2Device; |
254 patternDevice.Translate((FX_FLOAT)-rect.left, (FX_FLOAT)-rect.top); | 306 patternDevice.Translate((FX_FLOAT)-rect.left, (FX_FLOAT)-rect.top); |
255 if (CPDF_TilingPattern* pTilingPattern = m_pPattern->AsTilingPattern()) { | 307 if (CPDF_TilingPattern* pTilingPattern = m_pPattern->AsTilingPattern()) { |
256 bitmap_render.DrawTilingPattern(pTilingPattern, m_pImageObject, | 308 bitmap_render.DrawTilingPattern(pTilingPattern, m_pImageObject, |
257 &patternDevice, false); | 309 &patternDevice, false); |
258 } else if (CPDF_ShadingPattern* pShadingPattern = | 310 } else if (CPDF_ShadingPattern* pShadingPattern = |
259 m_pPattern->AsShadingPattern()) { | 311 m_pPattern->AsShadingPattern()) { |
260 bitmap_render.DrawShadingPattern(pShadingPattern, m_pImageObject, | 312 bitmap_render.DrawShadingPattern(pShadingPattern, m_pImageObject, |
261 &patternDevice, false); | 313 &patternDevice, false); |
262 } | 314 } |
263 | 315 |
264 CFX_FxgeDevice bitmap_device2; | 316 CFX_FxgeDevice bitmap_device2; |
265 if (!bitmap_device2.Create(rect.Width(), rect.Height(), FXDIB_8bppRgb, | 317 if (!bitmap_device2.Create(rect.Width(), rect.Height(), FXDIB_8bppRgb, |
266 nullptr)) { | 318 nullptr)) { |
267 return true; | 319 return true; |
268 } | 320 } |
269 bitmap_device2.GetBitmap()->Clear(0); | 321 bitmap_device2.GetBitmap()->Clear(0); |
270 CPDF_RenderStatus bitmap_render2; | 322 CalculateDrawImage(&bitmap_device1, &bitmap_device2, m_pDIBSource, |
271 bitmap_render2.Initialize(m_pRenderStatus->m_pContext, &bitmap_device2, | 323 &new_matrix, rect); |
272 nullptr, nullptr, nullptr, nullptr, nullptr, 0, | |
273 m_pRenderStatus->m_bDropObjects, nullptr, true); | |
274 CPDF_ImageRenderer image_render; | |
275 if (image_render.Start(&bitmap_render2, m_pDIBSource, 0xffffffff, 255, | |
276 &new_matrix, m_Flags, true, FXDIB_BLEND_NORMAL)) { | |
277 image_render.Continue(nullptr); | |
278 } | |
279 if (m_Loader.m_MatteColor != 0xffffffff) { | |
280 int matte_r = FXARGB_R(m_Loader.m_MatteColor); | |
281 int matte_g = FXARGB_G(m_Loader.m_MatteColor); | |
282 int matte_b = FXARGB_B(m_Loader.m_MatteColor); | |
283 for (int row = 0; row < height; row++) { | |
284 uint8_t* dest_scan = | |
285 (uint8_t*)bitmap_device1.GetBitmap()->GetScanline(row); | |
286 const uint8_t* mask_scan = bitmap_device2.GetBitmap()->GetScanline(row); | |
287 for (int col = 0; col < width; col++) { | |
288 int alpha = *mask_scan++; | |
289 if (!alpha) { | |
290 dest_scan += 4; | |
291 continue; | |
292 } | |
293 int orig = (*dest_scan - matte_b) * 255 / alpha + matte_b; | |
294 if (orig < 0) | |
295 orig = 0; | |
296 else if (orig > 255) | |
297 orig = 255; | |
298 *dest_scan++ = orig; | |
299 orig = (*dest_scan - matte_g) * 255 / alpha + matte_g; | |
300 if (orig < 0) | |
301 orig = 0; | |
302 else if (orig > 255) | |
303 orig = 255; | |
304 *dest_scan++ = orig; | |
305 orig = (*dest_scan - matte_r) * 255 / alpha + matte_r; | |
306 if (orig < 0) | |
307 orig = 0; | |
308 else if (orig > 255) | |
309 orig = 255; | |
310 *dest_scan++ = orig; | |
311 dest_scan++; | |
312 } | |
313 } | |
314 } | |
315 bitmap_device2.GetBitmap()->ConvertFormat(FXDIB_8bppMask); | 324 bitmap_device2.GetBitmap()->ConvertFormat(FXDIB_8bppMask); |
316 bitmap_device1.GetBitmap()->MultiplyAlpha(bitmap_device2.GetBitmap()); | 325 bitmap_device1.GetBitmap()->MultiplyAlpha(bitmap_device2.GetBitmap()); |
317 bitmap_device1.GetBitmap()->MultiplyAlpha(255); | 326 bitmap_device1.GetBitmap()->MultiplyAlpha(255); |
318 m_pRenderStatus->m_pDevice->SetDIBitsWithBlend( | 327 m_pRenderStatus->m_pDevice->SetDIBitsWithBlend( |
319 bitmap_device1.GetBitmap(), rect.left, rect.top, m_BlendType); | 328 bitmap_device1.GetBitmap(), rect.left, rect.top, m_BlendType); |
320 return false; | 329 return false; |
321 } | 330 } |
322 | 331 |
323 bool CPDF_ImageRenderer::DrawMaskedImage() { | 332 bool CPDF_ImageRenderer::DrawMaskedImage() { |
324 if (m_pRenderStatus->m_bPrint && | 333 if (NotDrawing()) { |
325 !(m_pRenderStatus->m_pDevice->GetRenderCaps() & FXRC_BLEND_MODE)) { | |
326 m_Result = false; | 334 m_Result = false; |
327 return false; | 335 return false; |
328 } | 336 } |
329 FX_RECT rect = m_ImageMatrix.GetUnitRect().GetOuterRect(); | 337 |
330 rect.Intersect(m_pRenderStatus->m_pDevice->GetClipBox()); | 338 FX_RECT rect = GetDrawRect(); |
331 if (rect.IsEmpty()) | 339 if (rect.IsEmpty()) |
332 return false; | 340 return false; |
333 | 341 |
334 CFX_Matrix new_matrix = m_ImageMatrix; | 342 CFX_Matrix new_matrix = GetDrawMatrix(rect); |
335 new_matrix.TranslateI(-rect.left, -rect.top); | |
336 int width = rect.Width(); | |
337 int height = rect.Height(); | |
338 CFX_FxgeDevice bitmap_device1; | 343 CFX_FxgeDevice bitmap_device1; |
339 if (!bitmap_device1.Create(width, height, FXDIB_Rgb32, nullptr)) | 344 if (!bitmap_device1.Create(rect.Width(), rect.Height(), FXDIB_Rgb32, nullptr)) |
340 return true; | 345 return true; |
341 | 346 |
342 #if defined _SKIA_SUPPORT_ | 347 #if defined _SKIA_SUPPORT_ |
343 bitmap_device1.Clear(0xffffff); | 348 bitmap_device1.Clear(0xffffff); |
344 #else | 349 #else |
345 bitmap_device1.GetBitmap()->Clear(0xffffff); | 350 bitmap_device1.GetBitmap()->Clear(0xffffff); |
346 #endif | 351 #endif |
347 CPDF_RenderStatus bitmap_render; | 352 CPDF_RenderStatus bitmap_render; |
348 bitmap_render.Initialize(m_pRenderStatus->m_pContext, &bitmap_device1, | 353 bitmap_render.Initialize(m_pRenderStatus->m_pContext, &bitmap_device1, |
349 nullptr, nullptr, nullptr, nullptr, nullptr, 0, | 354 nullptr, nullptr, nullptr, nullptr, nullptr, 0, |
350 m_pRenderStatus->m_bDropObjects, nullptr, true); | 355 m_pRenderStatus->m_bDropObjects, nullptr, true); |
351 CPDF_ImageRenderer image_render; | 356 CPDF_ImageRenderer image_render; |
352 if (image_render.Start(&bitmap_render, m_pDIBSource, 0, 255, &new_matrix, | 357 if (image_render.Start(&bitmap_render, m_pDIBSource, 0, 255, &new_matrix, |
353 m_Flags, true, FXDIB_BLEND_NORMAL)) { | 358 m_Flags, true, FXDIB_BLEND_NORMAL)) { |
354 image_render.Continue(nullptr); | 359 image_render.Continue(nullptr); |
355 } | 360 } |
356 CFX_FxgeDevice bitmap_device2; | 361 CFX_FxgeDevice bitmap_device2; |
357 if (!bitmap_device2.Create(width, height, FXDIB_8bppRgb, nullptr)) | 362 if (!bitmap_device2.Create(rect.Width(), rect.Height(), FXDIB_8bppRgb, |
| 363 nullptr)) |
358 return true; | 364 return true; |
359 | 365 |
360 #if defined _SKIA_SUPPORT_ | 366 #if defined _SKIA_SUPPORT_ |
361 bitmap_device2.Clear(0); | 367 bitmap_device2.Clear(0); |
362 #else | 368 #else |
363 bitmap_device2.GetBitmap()->Clear(0); | 369 bitmap_device2.GetBitmap()->Clear(0); |
364 #endif | 370 #endif |
365 CPDF_RenderStatus bitmap_render2; | 371 CalculateDrawImage(&bitmap_device1, &bitmap_device2, m_Loader.m_pMask, |
366 bitmap_render2.Initialize(m_pRenderStatus->m_pContext, &bitmap_device2, | 372 &new_matrix, rect); |
367 nullptr, nullptr, nullptr, nullptr, nullptr, 0, | |
368 m_pRenderStatus->m_bDropObjects, nullptr, true); | |
369 CPDF_ImageRenderer image_render2; | |
370 if (image_render2.Start(&bitmap_render2, m_Loader.m_pMask, 0xffffffff, 255, | |
371 &new_matrix, m_Flags, true, FXDIB_BLEND_NORMAL)) { | |
372 image_render2.Continue(nullptr); | |
373 } | |
374 if (m_Loader.m_MatteColor != 0xffffffff) { | |
375 int matte_r = FXARGB_R(m_Loader.m_MatteColor); | |
376 int matte_g = FXARGB_G(m_Loader.m_MatteColor); | |
377 int matte_b = FXARGB_B(m_Loader.m_MatteColor); | |
378 for (int row = 0; row < height; row++) { | |
379 uint8_t* dest_scan = | |
380 (uint8_t*)bitmap_device1.GetBitmap()->GetScanline(row); | |
381 const uint8_t* mask_scan = bitmap_device2.GetBitmap()->GetScanline(row); | |
382 for (int col = 0; col < width; col++) { | |
383 int alpha = *mask_scan++; | |
384 if (alpha) { | |
385 int orig = (*dest_scan - matte_b) * 255 / alpha + matte_b; | |
386 if (orig < 0) { | |
387 orig = 0; | |
388 } else if (orig > 255) { | |
389 orig = 255; | |
390 } | |
391 *dest_scan++ = orig; | |
392 orig = (*dest_scan - matte_g) * 255 / alpha + matte_g; | |
393 if (orig < 0) { | |
394 orig = 0; | |
395 } else if (orig > 255) { | |
396 orig = 255; | |
397 } | |
398 *dest_scan++ = orig; | |
399 orig = (*dest_scan - matte_r) * 255 / alpha + matte_r; | |
400 if (orig < 0) { | |
401 orig = 0; | |
402 } else if (orig > 255) { | |
403 orig = 255; | |
404 } | |
405 *dest_scan++ = orig; | |
406 dest_scan++; | |
407 } else { | |
408 dest_scan += 4; | |
409 } | |
410 } | |
411 } | |
412 } | |
413 #ifdef _SKIA_SUPPORT_ | 373 #ifdef _SKIA_SUPPORT_ |
414 m_pRenderStatus->m_pDevice->SetBitsWithMask( | 374 m_pRenderStatus->m_pDevice->SetBitsWithMask( |
415 bitmap_device1.GetBitmap(), bitmap_device2.GetBitmap(), rect.left, | 375 bitmap_device1.GetBitmap(), bitmap_device2.GetBitmap(), rect.left, |
416 rect.top, m_BitmapAlpha, m_BlendType); | 376 rect.top, m_BitmapAlpha, m_BlendType); |
417 #else | 377 #else |
418 bitmap_device2.GetBitmap()->ConvertFormat(FXDIB_8bppMask); | 378 bitmap_device2.GetBitmap()->ConvertFormat(FXDIB_8bppMask); |
419 bitmap_device1.GetBitmap()->MultiplyAlpha(bitmap_device2.GetBitmap()); | 379 bitmap_device1.GetBitmap()->MultiplyAlpha(bitmap_device2.GetBitmap()); |
420 if (m_BitmapAlpha < 255) | 380 if (m_BitmapAlpha < 255) |
421 bitmap_device1.GetBitmap()->MultiplyAlpha(m_BitmapAlpha); | 381 bitmap_device1.GetBitmap()->MultiplyAlpha(m_BitmapAlpha); |
422 m_pRenderStatus->m_pDevice->SetDIBitsWithBlend( | 382 m_pRenderStatus->m_pDevice->SetDIBitsWithBlend( |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
462 } | 422 } |
463 return false; | 423 return false; |
464 } | 424 } |
465 #endif | 425 #endif |
466 CFX_FloatRect image_rect_f = m_ImageMatrix.GetUnitRect(); | 426 CFX_FloatRect image_rect_f = m_ImageMatrix.GetUnitRect(); |
467 FX_RECT image_rect = image_rect_f.GetOuterRect(); | 427 FX_RECT image_rect = image_rect_f.GetOuterRect(); |
468 int dest_width = image_rect.Width(); | 428 int dest_width = image_rect.Width(); |
469 int dest_height = image_rect.Height(); | 429 int dest_height = image_rect.Height(); |
470 if ((FXSYS_fabs(m_ImageMatrix.b) >= 0.5f || m_ImageMatrix.a == 0) || | 430 if ((FXSYS_fabs(m_ImageMatrix.b) >= 0.5f || m_ImageMatrix.a == 0) || |
471 (FXSYS_fabs(m_ImageMatrix.c) >= 0.5f || m_ImageMatrix.d == 0)) { | 431 (FXSYS_fabs(m_ImageMatrix.c) >= 0.5f || m_ImageMatrix.d == 0)) { |
472 if (m_pRenderStatus->m_bPrint && | 432 if (NotDrawing()) { |
473 !(m_pRenderStatus->m_pDevice->GetRenderCaps() & FXRC_BLEND_MODE)) { | |
474 m_Result = false; | 433 m_Result = false; |
475 return false; | 434 return false; |
476 } | 435 } |
| 436 |
477 FX_RECT clip_box = m_pRenderStatus->m_pDevice->GetClipBox(); | 437 FX_RECT clip_box = m_pRenderStatus->m_pDevice->GetClipBox(); |
478 clip_box.Intersect(image_rect); | 438 clip_box.Intersect(image_rect); |
479 m_Status = 2; | 439 m_Status = 2; |
480 m_pTransformer.reset(new CFX_ImageTransformer(m_pDIBSource, &m_ImageMatrix, | 440 m_pTransformer.reset(new CFX_ImageTransformer(m_pDIBSource, &m_ImageMatrix, |
481 m_Flags, &clip_box)); | 441 m_Flags, &clip_box)); |
482 m_pTransformer->Start(); | 442 m_pTransformer->Start(); |
483 return true; | 443 return true; |
484 } | 444 } |
485 if (m_ImageMatrix.a < 0) | 445 if (m_ImageMatrix.a < 0) |
486 dest_width = -dest_width; | 446 dest_width = -dest_width; |
(...skipping 12 matching lines...) Expand all Loading... |
499 } | 459 } |
500 if (m_pDIBSource->IsAlphaMask()) { | 460 if (m_pDIBSource->IsAlphaMask()) { |
501 if (m_BitmapAlpha != 255) | 461 if (m_BitmapAlpha != 255) |
502 m_FillArgb = FXARGB_MUL_ALPHA(m_FillArgb, m_BitmapAlpha); | 462 m_FillArgb = FXARGB_MUL_ALPHA(m_FillArgb, m_BitmapAlpha); |
503 if (m_pRenderStatus->m_pDevice->StretchBitMaskWithFlags( | 463 if (m_pRenderStatus->m_pDevice->StretchBitMaskWithFlags( |
504 m_pDIBSource, dest_left, dest_top, dest_width, dest_height, | 464 m_pDIBSource, dest_left, dest_top, dest_width, dest_height, |
505 m_FillArgb, m_Flags)) { | 465 m_FillArgb, m_Flags)) { |
506 return false; | 466 return false; |
507 } | 467 } |
508 } | 468 } |
509 if (m_pRenderStatus->m_bPrint && | 469 if (NotDrawing()) { |
510 !(m_pRenderStatus->m_pDevice->GetRenderCaps() & FXRC_BLEND_MODE)) { | |
511 m_Result = false; | 470 m_Result = false; |
512 return true; | 471 return true; |
513 } | 472 } |
514 | 473 |
515 FX_RECT clip_box = m_pRenderStatus->m_pDevice->GetClipBox(); | 474 FX_RECT clip_box = m_pRenderStatus->m_pDevice->GetClipBox(); |
516 FX_RECT dest_rect = clip_box; | 475 FX_RECT dest_rect = clip_box; |
517 dest_rect.Intersect(image_rect); | 476 dest_rect.Intersect(image_rect); |
518 FX_RECT dest_clip( | 477 FX_RECT dest_clip( |
519 dest_rect.left - image_rect.left, dest_rect.top - image_rect.top, | 478 dest_rect.left - image_rect.left, dest_rect.top - image_rect.top, |
520 dest_rect.right - image_rect.left, dest_rect.bottom - image_rect.top); | 479 dest_rect.right - image_rect.left, dest_rect.bottom - image_rect.top); |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
599 | 558 |
600 if (m_Status == 4) { | 559 if (m_Status == 4) { |
601 if (m_Loader.Continue(pPause)) | 560 if (m_Loader.Continue(pPause)) |
602 return true; | 561 return true; |
603 | 562 |
604 if (StartRenderDIBSource()) | 563 if (StartRenderDIBSource()) |
605 return Continue(pPause); | 564 return Continue(pPause); |
606 } | 565 } |
607 return false; | 566 return false; |
608 } | 567 } |
OLD | NEW |