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

Unified Diff: src/gpu/SkGpuDevice.cpp

Issue 2241353002: pin as texture api (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fix comments Created 4 years, 4 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/gpu/GrImageIDTextureAdjuster.cpp ('k') | src/image/SkImage.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/SkGpuDevice.cpp
diff --git a/src/gpu/SkGpuDevice.cpp b/src/gpu/SkGpuDevice.cpp
index dd68a407c9404208640e519d7120d85a785cc6a3..a4c00b60c29a086118787023398c0e3d95c51ffb 100644
--- a/src/gpu/SkGpuDevice.cpp
+++ b/src/gpu/SkGpuDevice.cpp
@@ -1356,9 +1356,11 @@ void SkGpuDevice::drawImage(const SkDraw& draw, const SkImage* image, SkScalar x
ASSERT_SINGLE_OWNER
SkMatrix viewMatrix = *draw.fMatrix;
viewMatrix.preTranslate(x, y);
- if (as_IB(image)->peekTexture()) {
+ uint32_t pinnedUniqueID;
+ if (sk_sp<GrTexture> tex = as_IB(image)->refPinnedTexture(&pinnedUniqueID)) {
CHECK_SHOULD_DRAW(draw);
- GrImageTextureAdjuster adjuster(as_IB(image));
+ GrTextureAdjuster adjuster(tex.get(), image->bounds(), pinnedUniqueID,
+ as_IB(image)->onImageInfo().colorSpace());
this->drawTextureProducer(&adjuster, nullptr, nullptr, SkCanvas::kFast_SrcRectConstraint,
viewMatrix, fClip, paint);
return;
@@ -1386,9 +1388,11 @@ void SkGpuDevice::drawImageRect(const SkDraw& draw, const SkImage* image, const
const SkRect& dst, const SkPaint& paint,
SkCanvas::SrcRectConstraint constraint) {
ASSERT_SINGLE_OWNER
- if (as_IB(image)->peekTexture()) {
+ uint32_t pinnedUniqueID;
+ if (sk_sp<GrTexture> tex = as_IB(image)->refPinnedTexture(&pinnedUniqueID)) {
CHECK_SHOULD_DRAW(draw);
- GrImageTextureAdjuster adjuster(as_IB(image));
+ GrTextureAdjuster adjuster(tex.get(), image->bounds(), pinnedUniqueID,
+ as_IB(image)->onImageInfo().colorSpace());
this->drawTextureProducer(&adjuster, src, &dst, constraint, *draw.fMatrix, fClip, paint);
return;
}
@@ -1454,8 +1458,11 @@ void SkGpuDevice::drawProducerNine(const SkDraw& draw, GrTextureProducer* produc
void SkGpuDevice::drawImageNine(const SkDraw& draw, const SkImage* image,
const SkIRect& center, const SkRect& dst, const SkPaint& paint) {
ASSERT_SINGLE_OWNER
- if (as_IB(image)->peekTexture()) {
- GrImageTextureAdjuster adjuster(as_IB(image));
+ uint32_t pinnedUniqueID;
+ if (sk_sp<GrTexture> tex = as_IB(image)->refPinnedTexture(&pinnedUniqueID)) {
+ CHECK_SHOULD_DRAW(draw);
+ GrTextureAdjuster adjuster(tex.get(), image->bounds(), pinnedUniqueID,
+ as_IB(image)->onImageInfo().colorSpace());
this->drawProducerNine(draw, &adjuster, center, dst, paint);
} else {
SkBitmap bm;
« no previous file with comments | « src/gpu/GrImageIDTextureAdjuster.cpp ('k') | src/image/SkImage.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698