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

Side by Side Diff: src/image/SkImage_Gpu.cpp

Issue 19729007: Add SkImage->draw() call with src and dst rects. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/image/SkImage_Codec.cpp ('k') | src/image/SkImage_Picture.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2012 Google Inc. 2 * Copyright 2012 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "SkImage_Base.h" 8 #include "SkImage_Base.h"
9 #include "SkImagePriv.h" 9 #include "SkImagePriv.h"
10 #include "SkBitmap.h" 10 #include "SkBitmap.h"
11 #include "SkCanvas.h" 11 #include "SkCanvas.h"
12 #include "GrContext.h" 12 #include "GrContext.h"
13 #include "GrTexture.h" 13 #include "GrTexture.h"
14 #include "SkGrPixelRef.h" 14 #include "SkGrPixelRef.h"
15 15
16 class SkImage_Gpu : public SkImage_Base { 16 class SkImage_Gpu : public SkImage_Base {
17 public: 17 public:
18 SK_DECLARE_INST_COUNT(SkImage_Gpu) 18 SK_DECLARE_INST_COUNT(SkImage_Gpu)
19 19
20 SkImage_Gpu(GrTexture*); 20 SkImage_Gpu(GrTexture*);
21 virtual ~SkImage_Gpu(); 21 virtual ~SkImage_Gpu();
22 22
23 virtual void onDraw(SkCanvas*, SkScalar x, SkScalar y, const SkPaint*) SK_OV ERRIDE; 23 virtual void onDraw(SkCanvas*, SkScalar x, SkScalar y, const SkPaint*) SK_OV ERRIDE;
24 virtual void onDrawRectToRect(SkCanvas*, const SkRect* src, const SkRect& ds t, const SkPaint*) SK_OVERRIDE;
24 virtual GrTexture* onGetTexture() SK_OVERRIDE; 25 virtual GrTexture* onGetTexture() SK_OVERRIDE;
25 virtual bool getROPixels(SkBitmap*) const SK_OVERRIDE { 26 virtual bool getROPixels(SkBitmap*) const SK_OVERRIDE {
26 // TODO 27 // TODO
27 return false; 28 return false;
28 } 29 }
29 30
30 GrTexture* getTexture() { return fTexture; } 31 GrTexture* getTexture() { return fTexture; }
31 32
32 void setTexture(GrTexture* texture); 33 void setTexture(GrTexture* texture);
33 34
(...skipping 20 matching lines...) Expand all
54 55
55 SkImage_Gpu::~SkImage_Gpu() { 56 SkImage_Gpu::~SkImage_Gpu() {
56 SkSafeUnref(fTexture); 57 SkSafeUnref(fTexture);
57 } 58 }
58 59
59 void SkImage_Gpu::onDraw(SkCanvas* canvas, SkScalar x, SkScalar y, 60 void SkImage_Gpu::onDraw(SkCanvas* canvas, SkScalar x, SkScalar y,
60 const SkPaint* paint) { 61 const SkPaint* paint) {
61 canvas->drawBitmap(fBitmap, x, y, paint); 62 canvas->drawBitmap(fBitmap, x, y, paint);
62 } 63 }
63 64
65 void SkImage_Gpu::onDrawRectToRect(SkCanvas* canvas, const SkRect* src, const Sk Rect& dst,
66 const SkPaint* paint) {
67 canvas->drawBitmapRectToRect(fBitmap, src, dst, paint);
68 }
69
64 GrTexture* SkImage_Gpu::onGetTexture() { 70 GrTexture* SkImage_Gpu::onGetTexture() {
65 return fTexture; 71 return fTexture;
66 } 72 }
67 73
68 void SkImage_Gpu::setTexture(GrTexture* texture) { 74 void SkImage_Gpu::setTexture(GrTexture* texture) {
69 75
70 if (texture == fTexture) { 76 if (texture == fTexture) {
71 return; 77 return;
72 } 78 }
73 79
(...skipping 11 matching lines...) Expand all
85 return SkNEW_ARGS(SkImage_Gpu, (texture)); 91 return SkNEW_ARGS(SkImage_Gpu, (texture));
86 } 92 }
87 93
88 GrTexture* SkTextureImageGetTexture(SkImage* image) { 94 GrTexture* SkTextureImageGetTexture(SkImage* image) {
89 return ((SkImage_Gpu*)image)->getTexture(); 95 return ((SkImage_Gpu*)image)->getTexture();
90 } 96 }
91 97
92 void SkTextureImageSetTexture(SkImage* image, GrTexture* texture) { 98 void SkTextureImageSetTexture(SkImage* image, GrTexture* texture) {
93 ((SkImage_Gpu*)image)->setTexture(texture); 99 ((SkImage_Gpu*)image)->setTexture(texture);
94 } 100 }
OLDNEW
« no previous file with comments | « src/image/SkImage_Codec.cpp ('k') | src/image/SkImage_Picture.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698