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

Unified Diff: src/gpu/SkGpuDevice.h

Issue 2173513002: Cleanup of code that converts from GPU-backed resources to SkImageInfo (Closed) Base URL: https://skia.googlesource.com/skia.git@fix-sync
Patch Set: Created 4 years, 5 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
Index: src/gpu/SkGpuDevice.h
diff --git a/src/gpu/SkGpuDevice.h b/src/gpu/SkGpuDevice.h
index 811175937c8dddd7d2ace4596e3aaf6fc0522b83..7e646a13f162e72777e56fa38f130e4466ccc0fe 100644
--- a/src/gpu/SkGpuDevice.h
+++ b/src/gpu/SkGpuDevice.h
@@ -9,6 +9,7 @@
#define SkGpuDevice_DEFINED
#include "SkGr.h"
+#include "SkGrPriv.h"
#include "SkBitmap.h"
#include "SkDevice.h"
#include "SkPicture.h"
@@ -82,10 +83,13 @@ public:
GrDrawContext* accessDrawContext() override;
SkImageInfo imageInfo() const override {
- SkAlphaType at = fOpaque ? kOpaque_SkAlphaType : kPremul_SkAlphaType;
- SkImageInfo info = fRenderTarget->surfacePriv().info(at).makeWH(fSize.fWidth,
- fSize.fHeight);
- return info;
+ SkColorType colorType;
+ if (!GrPixelConfigToColorType(fRenderTarget->config(), &colorType)) {
+ colorType = kUnknown_SkColorType;
+ }
+ return SkImageInfo::Make(fSize.fWidth, fSize.fHeight, colorType,
+ fOpaque ? kOpaque_SkAlphaType : kPremul_SkAlphaType,
+ sk_ref_sp(fDrawContext->getColorSpace()));
}
void drawPaint(const SkDraw&, const SkPaint& paint) override;
« no previous file with comments | « src/gpu/GrSurfacePriv.h ('k') | src/gpu/SkGr.cpp » ('j') | src/image/SkImage_Gpu.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698