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

Unified Diff: src/gpu/GrImageIDTextureAdjuster.cpp

Issue 2242373002: simplify GrTextureAdjuster given there is only one subclass (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 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.h ('k') | src/gpu/GrTextureParamsAdjuster.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrImageIDTextureAdjuster.cpp
diff --git a/src/gpu/GrImageIDTextureAdjuster.cpp b/src/gpu/GrImageIDTextureAdjuster.cpp
index 989102e740f2811dd428ffc30449cd9b3432206d..2bfa21c7293c814f0004feba3cf61bb65b292beb 100644
--- a/src/gpu/GrImageIDTextureAdjuster.cpp
+++ b/src/gpu/GrImageIDTextureAdjuster.cpp
@@ -17,32 +17,13 @@
static bool bmp_is_alpha_only(const SkBitmap& bm) { return kAlpha_8_SkColorType == bm.colorType(); }
-// SkImage's don't have a way of communicating whether they're alpha-only. So we fallback to
-// inspecting the texture.
-static bool tex_image_is_alpha_only(const SkImage_Base& img) {
- return GrPixelConfigIsAlphaOnly(img.peekTexture()->config());
-}
-
+// By construction this texture adjuster always represents an entire SkImage, so use the
+// image's dimensions for the key's rectangle.
GrImageTextureAdjuster::GrImageTextureAdjuster(const SkImage_Base* img)
- : INHERITED(img->peekTexture(), SkIRect::MakeWH(img->width(), img->height()),
- tex_image_is_alpha_only(*img))
- , fImageBase(img) {}
-
-void GrImageTextureAdjuster::makeCopyKey(const CopyParams& params, GrUniqueKey* copyKey) {
- // By construction this texture adjuster always represents an entire SkImage, so use the
- // image's width and height for the key's rectangle.
- GrUniqueKey baseKey;
- GrMakeKeyFromImageID(&baseKey, fImageBase->uniqueID(),
- SkIRect::MakeWH(fImageBase->width(), fImageBase->height()));
- MakeCopyKeyFromOrigKey(baseKey, params, copyKey);
-}
-
-void GrImageTextureAdjuster::didCacheCopy(const GrUniqueKey& copyKey) {
- // We don't currently have a mechanism for notifications on Images!
-}
-
-SkColorSpace* GrImageTextureAdjuster::getColorSpace() {
- return fImageBase->onImageInfo().colorSpace();
+ : GrTextureAdjuster(img->peekTexture(), SkIRect::MakeSize(img->dimensions()), img->uniqueID(),
+ img->onImageInfo().colorSpace())
+{
+ SkASSERT(img->peekTexture());
}
//////////////////////////////////////////////////////////////////////////////
« no previous file with comments | « src/gpu/GrImageIDTextureAdjuster.h ('k') | src/gpu/GrTextureParamsAdjuster.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698