Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(204)

Side by Side Diff: core/fxge/skia/fx_skia_device.cpp

Issue 2468443002: remove deprecated skia transfer mode usage (Closed)
Patch Set: Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « DEPS ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 PDFium Authors. All rights reserved. 1 // Copyright 2014 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 #include <algorithm> 5 #include <algorithm>
6 #include <vector> 6 #include <vector>
7 7
8 #include "core/fxcodec/fx_codec.h" 8 #include "core/fxcodec/fx_codec.h"
9 #include "core/fxcrt/fx_memory.h" 9 #include "core/fxcrt/fx_memory.h"
10 10
(...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after
379 } 379 }
380 380
381 void SetBitmapPaint(bool isAlphaMask, 381 void SetBitmapPaint(bool isAlphaMask,
382 uint32_t argb, 382 uint32_t argb,
383 int bitmap_alpha, 383 int bitmap_alpha,
384 int blend_type, 384 int blend_type,
385 SkPaint* paint) { 385 SkPaint* paint) {
386 paint->setAntiAlias(true); 386 paint->setAntiAlias(true);
387 if (isAlphaMask) { 387 if (isAlphaMask) {
388 paint->setColorFilter( 388 paint->setColorFilter(
389 SkColorFilter::MakeModeFilter(argb, SkXfermode::kSrc_Mode)); 389 SkColorFilter::MakeModeFilter(argb, SkBlendMode::kSrc));
390 } 390 }
391 // paint->setFilterQuality(kHigh_SkFilterQuality); 391 // paint->setFilterQuality(kHigh_SkFilterQuality);
392 paint->setBlendMode(GetSkiaBlendMode(blend_type)); 392 paint->setBlendMode(GetSkiaBlendMode(blend_type));
393 paint->setAlpha(bitmap_alpha); 393 paint->setAlpha(bitmap_alpha);
394 } 394 }
395 395
396 bool Upsample(const CFX_DIBSource* pSource, 396 bool Upsample(const CFX_DIBSource* pSource,
397 std::unique_ptr<uint8_t, FxFreeDeleter>& dst8Storage, 397 std::unique_ptr<uint8_t, FxFreeDeleter>& dst8Storage,
398 std::unique_ptr<uint32_t, FxFreeDeleter>& dst32Storage, 398 std::unique_ptr<uint32_t, FxFreeDeleter>& dst32Storage,
399 SkColorTable** ctPtr, 399 SkColorTable** ctPtr,
(...skipping 1125 matching lines...) Expand 10 before | Expand all | Expand 10 after
1525 m_pCanvas->concat(skMatrix); 1525 m_pCanvas->concat(skMatrix);
1526 SkPaint paint; 1526 SkPaint paint;
1527 SetBitmapPaint(pSource->IsAlphaMask(), 0xFFFFFFFF, bitmap_alpha, blend_type, 1527 SetBitmapPaint(pSource->IsAlphaMask(), 0xFFFFFFFF, bitmap_alpha, blend_type,
1528 &paint); 1528 &paint);
1529 sk_sp<SkImage> skSrc = SkImage::MakeFromBitmap(skBitmap); 1529 sk_sp<SkImage> skSrc = SkImage::MakeFromBitmap(skBitmap);
1530 sk_sp<SkShader> skSrcShader = 1530 sk_sp<SkShader> skSrcShader =
1531 skSrc->makeShader(SkShader::kClamp_TileMode, SkShader::kClamp_TileMode); 1531 skSrc->makeShader(SkShader::kClamp_TileMode, SkShader::kClamp_TileMode);
1532 sk_sp<SkImage> skMaskImage = SkImage::MakeFromBitmap(skMask); 1532 sk_sp<SkImage> skMaskImage = SkImage::MakeFromBitmap(skMask);
1533 sk_sp<SkShader> skMaskShader = skMaskImage->makeShader( 1533 sk_sp<SkShader> skMaskShader = skMaskImage->makeShader(
1534 SkShader::kClamp_TileMode, SkShader::kClamp_TileMode); 1534 SkShader::kClamp_TileMode, SkShader::kClamp_TileMode);
1535 sk_sp<SkXfermode> dstInMode = SkXfermode::Make(SkXfermode::kSrcIn_Mode); 1535 paint.setShader(SkShader::MakeComposeShader(skMaskShader, skSrcShader,
1536 paint.setShader( 1536 SkBlendMode::kSrcIn));
1537 SkShader::MakeComposeShader(skMaskShader, skSrcShader, dstInMode));
1538 SkRect r = {0, 0, SkIntToScalar(srcWidth), SkIntToScalar(srcHeight)}; 1537 SkRect r = {0, 0, SkIntToScalar(srcWidth), SkIntToScalar(srcHeight)};
1539 m_pCanvas->drawRect(r, paint); 1538 m_pCanvas->drawRect(r, paint);
1540 m_pCanvas->restore(); 1539 m_pCanvas->restore();
1541 if (srcCt) 1540 if (srcCt)
1542 srcCt->unref(); 1541 srcCt->unref();
1543 DebugValidate(m_pBitmap, m_pOriDevice); 1542 DebugValidate(m_pBitmap, m_pOriDevice);
1544 return true; 1543 return true;
1545 } 1544 }
1546 1545
1547 bool CFX_SkiaDeviceDriver::SetBitsWithMask(const CFX_DIBSource* pBitmap, 1546 bool CFX_SkiaDeviceDriver::SetBitsWithMask(const CFX_DIBSource* pBitmap,
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
1669 uint8_t g = SkGetPackedG32(srcRow[x]); 1668 uint8_t g = SkGetPackedG32(srcRow[x]);
1670 uint8_t b = SkGetPackedB32(srcRow[x]); 1669 uint8_t b = SkGetPackedB32(srcRow[x]);
1671 SkA32Assert(a); 1670 SkA32Assert(a);
1672 SkASSERT(r <= a); 1671 SkASSERT(r <= a);
1673 SkASSERT(g <= a); 1672 SkASSERT(g <= a);
1674 SkASSERT(b <= a); 1673 SkASSERT(b <= a);
1675 } 1674 }
1676 } 1675 }
1677 #endif 1676 #endif
1678 } 1677 }
OLDNEW
« no previous file with comments | « DEPS ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698