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

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

Issue 345463009: Deleted SkImage::newShaderClamp: not used, not implemented. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Organizing includes of SkImage.h Created 6 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
« 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 #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 explicit SkImage_Gpu(const SkBitmap&); 20 explicit SkImage_Gpu(const SkBitmap&);
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 void onDrawRectToRect(SkCanvas*, const SkRect* src, const SkRect& ds t, const SkPaint*) SK_OVERRIDE;
25 virtual GrTexture* onGetTexture() SK_OVERRIDE; 25 virtual GrTexture* onGetTexture() SK_OVERRIDE;
26 virtual bool getROPixels(SkBitmap*) const SK_OVERRIDE; 26 virtual bool getROPixels(SkBitmap*) const SK_OVERRIDE;
27 27
28 GrTexture* getTexture() { return fBitmap.getTexture(); } 28 GrTexture* getTexture() { return fBitmap.getTexture(); }
29 29
30 virtual SkShader* onNewShader(SkShader::TileMode, SkShader::TileMode) const SK_OVERRIDE;
30 private: 31 private:
31 SkBitmap fBitmap; 32 SkBitmap fBitmap;
32 33
33 typedef SkImage_Base INHERITED; 34 typedef SkImage_Base INHERITED;
34 }; 35 };
35 36
36 /////////////////////////////////////////////////////////////////////////////// 37 ///////////////////////////////////////////////////////////////////////////////
37 38
38 SkImage_Gpu::SkImage_Gpu(const SkBitmap& bitmap) 39 SkImage_Gpu::SkImage_Gpu(const SkBitmap& bitmap)
39 : INHERITED(bitmap.width(), bitmap.height()) 40 : INHERITED(bitmap.width(), bitmap.height())
40 , fBitmap(bitmap) { 41 , fBitmap(bitmap) {
41 SkASSERT(NULL != fBitmap.getTexture()); 42 SkASSERT(NULL != fBitmap.getTexture());
42 } 43 }
43 44
44 SkImage_Gpu::~SkImage_Gpu() { 45 SkImage_Gpu::~SkImage_Gpu() {
45 } 46 }
46 47
48 SkShader* SkImage_Gpu::onNewShader(SkShader::TileMode tileX, SkShader::TileMode tileY) const {
49 return SkShader::CreateBitmapShader(fBitmap, tileX, tileY, NULL);
50 }
51
47 void SkImage_Gpu::onDraw(SkCanvas* canvas, SkScalar x, SkScalar y, 52 void SkImage_Gpu::onDraw(SkCanvas* canvas, SkScalar x, SkScalar y,
48 const SkPaint* paint) { 53 const SkPaint* paint) {
49 canvas->drawBitmap(fBitmap, x, y, paint); 54 canvas->drawBitmap(fBitmap, x, y, paint);
50 } 55 }
51 56
52 void SkImage_Gpu::onDrawRectToRect(SkCanvas* canvas, const SkRect* src, const Sk Rect& dst, 57 void SkImage_Gpu::onDrawRectToRect(SkCanvas* canvas, const SkRect* src, const Sk Rect& dst,
53 const SkPaint* paint) { 58 const SkPaint* paint) {
54 canvas->drawBitmapRectToRect(fBitmap, src, dst, paint); 59 canvas->drawBitmapRectToRect(fBitmap, src, dst, paint);
55 } 60 }
56 61
(...skipping 11 matching lines...) Expand all
68 if (NULL == bitmap.getTexture()) { 73 if (NULL == bitmap.getTexture()) {
69 return NULL; 74 return NULL;
70 } 75 }
71 76
72 return SkNEW_ARGS(SkImage_Gpu, (bitmap)); 77 return SkNEW_ARGS(SkImage_Gpu, (bitmap));
73 } 78 }
74 79
75 GrTexture* SkTextureImageGetTexture(SkImage* image) { 80 GrTexture* SkTextureImageGetTexture(SkImage* image) {
76 return ((SkImage_Gpu*)image)->getTexture(); 81 return ((SkImage_Gpu*)image)->getTexture();
77 } 82 }
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