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

Unified Diff: src/gpu/SkGpuDevice.cpp

Issue 1127993004: Revert of Revert of Revert of Make drawImage a virtual on SkDevice (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 7 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/SkGpuDevice.h ('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 9518600e9948cd681e1bf9f4fb587bc046ccce1c..6ff0538ee2ca833bfbfcc145d8dbd0ba605fef4c 100644
--- a/src/gpu/SkGpuDevice.cpp
+++ b/src/gpu/SkGpuDevice.cpp
@@ -21,7 +21,6 @@
#include "SkErrorInternals.h"
#include "SkGlyphCache.h"
#include "SkGrTexturePixelRef.h"
-#include "SkImage_Base.h"
#include "SkImageFilter.h"
#include "SkLayerInfo.h"
#include "SkMaskFilter.h"
@@ -1731,47 +1730,6 @@
filter, ctx, result, offset);
}
-static SkImageInfo make_info(GrTexture* tex, int w, int h, bool isOpaque) {
- const GrPixelConfig config = tex->config();
- SkColorType ct;
- SkAlphaType at = isOpaque ? kOpaque_SkAlphaType : kPremul_SkAlphaType;
- if (!GrPixelConfig2ColorAndProfileType(config, &ct, NULL)) {
- ct = kUnknown_SkColorType;
- }
- return SkImageInfo::Make(w, h, ct, at);
-}
-
-static bool wrap_as_bm(const SkImage* image, SkBitmap* bm) {
- GrTexture* tex = image->getTexture();
- if (tex) {
- // TODO: handle the GrTexture directly, and skip GrPixelRef
- const SkImageInfo info = make_info(tex, image->width(), image->height(), image->isOpaque());
- bm->setInfo(info);
- bm->setPixelRef(SkNEW_ARGS(SkGrPixelRef, (info, tex)))->unref();
- } else {
- if (!as_IB(image)->getROPixels(bm)) {
- return false;
- }
- }
- return true;
-}
-
-void SkGpuDevice::drawImage(const SkDraw& draw, const SkImage* image, SkScalar x, SkScalar y,
- const SkPaint& paint) {
- SkBitmap bm;
- if (wrap_as_bm(image, &bm)) {
- this->drawBitmap(draw, bm, SkMatrix::MakeTrans(x, y), paint);
- }
-}
-
-void SkGpuDevice::drawImageRect(const SkDraw& draw, const SkImage* image, const SkRect* src,
- const SkRect& dst, const SkPaint& paint) {
- SkBitmap bm;
- if (wrap_as_bm(image, &bm)) {
- this->drawBitmapRect(draw, bm, src, dst, paint, SkCanvas::kNone_DrawBitmapRectFlag);
- }
-}
-
///////////////////////////////////////////////////////////////////////////////
// must be in SkCanvas::VertexMode order
« no previous file with comments | « src/gpu/SkGpuDevice.h ('k') | src/image/SkImage.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698