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

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

Issue 605843002: Rename SkImage::draw(_, SkRect, SkRect) in SkImage::drawRect() (Closed) Base URL: https://skia.googlesource.com/skia.git@skimage_draw_forgot
Patch Set: Created 6 years, 2 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
« no previous file with comments | « src/image/SkImage_Base.h ('k') | src/image/SkImage_Raster.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 14
15 class SkImage_Gpu : public SkImage_Base { 15 class SkImage_Gpu : public SkImage_Base {
16 public: 16 public:
17 SK_DECLARE_INST_COUNT(SkImage_Gpu) 17 SK_DECLARE_INST_COUNT(SkImage_Gpu)
18 18
19 explicit SkImage_Gpu(const SkBitmap&); 19 explicit SkImage_Gpu(const SkBitmap&);
20 virtual ~SkImage_Gpu(); 20 virtual ~SkImage_Gpu();
21 21
22 virtual void onDraw(SkCanvas*, SkScalar x, SkScalar y, const SkPaint*) const SK_OVERRIDE; 22 virtual void onDraw(SkCanvas*, SkScalar x, SkScalar y, const SkPaint*) const SK_OVERRIDE;
23 virtual void onDrawRectToRect(SkCanvas*, const SkRect* src, const SkRect& ds t, 23 virtual void onDrawRect(SkCanvas*, const SkRect* src, const SkRect& dst,
24 const SkPaint*) const SK_OVERRIDE; 24 const SkPaint*) const SK_OVERRIDE;
25 virtual GrTexture* onGetTexture() const SK_OVERRIDE; 25 virtual GrTexture* onGetTexture() const SK_OVERRIDE;
26 virtual bool getROPixels(SkBitmap*) const SK_OVERRIDE; 26 virtual bool getROPixels(SkBitmap*) const SK_OVERRIDE;
27 27
28 GrTexture* getTexture() const { return fBitmap.getTexture(); } 28 GrTexture* getTexture() const { return fBitmap.getTexture(); }
29 29
30 virtual SkShader* onNewShader(SkShader::TileMode, 30 virtual SkShader* onNewShader(SkShader::TileMode,
31 SkShader::TileMode, 31 SkShader::TileMode,
32 const SkMatrix* localMatrix) const SK_OVERRIDE ; 32 const SkMatrix* localMatrix) const SK_OVERRIDE ;
33 33
(...skipping 20 matching lines...) Expand all
54 SkShader::TileMode tileY, 54 SkShader::TileMode tileY,
55 const SkMatrix* localMatrix) const 55 const SkMatrix* localMatrix) const
56 { 56 {
57 return SkShader::CreateBitmapShader(fBitmap, tileX, tileY, localMatrix); 57 return SkShader::CreateBitmapShader(fBitmap, tileX, tileY, localMatrix);
58 } 58 }
59 59
60 void SkImage_Gpu::onDraw(SkCanvas* canvas, SkScalar x, SkScalar y, const SkPaint * paint) const { 60 void SkImage_Gpu::onDraw(SkCanvas* canvas, SkScalar x, SkScalar y, const SkPaint * paint) const {
61 canvas->drawBitmap(fBitmap, x, y, paint); 61 canvas->drawBitmap(fBitmap, x, y, paint);
62 } 62 }
63 63
64 void SkImage_Gpu::onDrawRectToRect(SkCanvas* canvas, const SkRect* src, const Sk Rect& dst, 64 void SkImage_Gpu::onDrawRect(SkCanvas* canvas, const SkRect* src, const SkRect& dst,
65 const SkPaint* paint) const { 65 const SkPaint* paint) const {
66 canvas->drawBitmapRectToRect(fBitmap, src, dst, paint); 66 canvas->drawBitmapRectToRect(fBitmap, src, dst, paint);
67 } 67 }
68 68
69 GrTexture* SkImage_Gpu::onGetTexture() const { 69 GrTexture* SkImage_Gpu::onGetTexture() const {
70 return fBitmap.getTexture(); 70 return fBitmap.getTexture();
71 } 71 }
72 72
73 bool SkImage_Gpu::getROPixels(SkBitmap* dst) const { 73 bool SkImage_Gpu::getROPixels(SkBitmap* dst) const {
74 return fBitmap.copyTo(dst, kN32_SkColorType); 74 return fBitmap.copyTo(dst, kN32_SkColorType);
75 } 75 }
76 76
77 bool SkImage_Gpu::isOpaque() const { 77 bool SkImage_Gpu::isOpaque() const {
78 return fBitmap.isOpaque(); 78 return fBitmap.isOpaque();
79 } 79 }
80 80
81 /////////////////////////////////////////////////////////////////////////////// 81 ///////////////////////////////////////////////////////////////////////////////
82 82
83 SkImage* SkImage::NewTexture(const SkBitmap& bitmap) { 83 SkImage* SkImage::NewTexture(const SkBitmap& bitmap) {
84 if (NULL == bitmap.getTexture()) { 84 if (NULL == bitmap.getTexture()) {
85 return NULL; 85 return NULL;
86 } 86 }
87 87
88 return SkNEW_ARGS(SkImage_Gpu, (bitmap)); 88 return SkNEW_ARGS(SkImage_Gpu, (bitmap));
89 } 89 }
90 90
91 GrTexture* SkTextureImageGetTexture(SkImage* image) { 91 GrTexture* SkTextureImageGetTexture(SkImage* image) {
92 return ((SkImage_Gpu*)image)->getTexture(); 92 return ((SkImage_Gpu*)image)->getTexture();
93 } 93 }
OLDNEW
« no previous file with comments | « src/image/SkImage_Base.h ('k') | src/image/SkImage_Raster.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698