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

Side by Side Diff: src/image/SkImage_Raster.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_Gpu.cpp ('k') | tests/ImageNewShaderTest.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"
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 virtual void onDrawRectToRect(SkCanvas*, const SkRect*, const SkRect&, const SkPaint*) SK_OVERRIDE; 57 virtual void onDrawRectToRect(SkCanvas*, const SkRect*, const SkRect&, const SkPaint*) SK_OVERRIDE;
58 virtual bool onReadPixels(SkBitmap*, const SkIRect&) const SK_OVERRIDE; 58 virtual bool onReadPixels(SkBitmap*, const SkIRect&) const SK_OVERRIDE;
59 virtual const void* onPeekPixels(SkImageInfo*, size_t* /*rowBytes*/) const S K_OVERRIDE; 59 virtual const void* onPeekPixels(SkImageInfo*, size_t* /*rowBytes*/) const S K_OVERRIDE;
60 virtual bool getROPixels(SkBitmap*) const SK_OVERRIDE; 60 virtual bool getROPixels(SkBitmap*) const SK_OVERRIDE;
61 61
62 // exposed for SkSurface_Raster via SkNewImageFromPixelRef 62 // exposed for SkSurface_Raster via SkNewImageFromPixelRef
63 SkImage_Raster(const SkImageInfo&, SkPixelRef*, size_t rowBytes); 63 SkImage_Raster(const SkImageInfo&, SkPixelRef*, size_t rowBytes);
64 64
65 SkPixelRef* getPixelRef() const { return fBitmap.pixelRef(); } 65 SkPixelRef* getPixelRef() const { return fBitmap.pixelRef(); }
66 66
67 virtual SkShader* onNewShader(SkShader::TileMode, SkShader::TileMode) const SK_OVERRIDE;
68
67 private: 69 private:
68 SkImage_Raster() : INHERITED(0, 0) {} 70 SkImage_Raster() : INHERITED(0, 0) {}
69 71
70 SkBitmap fBitmap; 72 SkBitmap fBitmap;
71 73
72 typedef SkImage_Base INHERITED; 74 typedef SkImage_Base INHERITED;
73 }; 75 };
74 76
75 /////////////////////////////////////////////////////////////////////////////// 77 ///////////////////////////////////////////////////////////////////////////////
76 78
(...skipping 27 matching lines...) Expand all
104 SkImage_Raster::SkImage_Raster(const Info& info, SkPixelRef* pr, size_t rowBytes ) 106 SkImage_Raster::SkImage_Raster(const Info& info, SkPixelRef* pr, size_t rowBytes )
105 : INHERITED(info.fWidth, info.fHeight) 107 : INHERITED(info.fWidth, info.fHeight)
106 { 108 {
107 fBitmap.setInfo(info, rowBytes); 109 fBitmap.setInfo(info, rowBytes);
108 fBitmap.setPixelRef(pr); 110 fBitmap.setPixelRef(pr);
109 fBitmap.lockPixels(); 111 fBitmap.lockPixels();
110 } 112 }
111 113
112 SkImage_Raster::~SkImage_Raster() {} 114 SkImage_Raster::~SkImage_Raster() {}
113 115
116 SkShader* SkImage_Raster::onNewShader(SkShader::TileMode tileX, SkShader::TileMo de tileY) const {
117 return SkShader::CreateBitmapShader(fBitmap, tileX, tileY, NULL);
118 }
119
114 void SkImage_Raster::onDraw(SkCanvas* canvas, SkScalar x, SkScalar y, const SkPa int* paint) { 120 void SkImage_Raster::onDraw(SkCanvas* canvas, SkScalar x, SkScalar y, const SkPa int* paint) {
115 canvas->drawBitmap(fBitmap, x, y, paint); 121 canvas->drawBitmap(fBitmap, x, y, paint);
116 } 122 }
117 123
118 void SkImage_Raster::onDrawRectToRect(SkCanvas* canvas, const SkRect* src, 124 void SkImage_Raster::onDrawRectToRect(SkCanvas* canvas, const SkRect* src,
119 const SkRect& dst, const SkPaint* paint) { 125 const SkRect& dst, const SkPaint* paint) {
120 canvas->drawBitmapRectToRect(fBitmap, src, dst, paint); 126 canvas->drawBitmapRectToRect(fBitmap, src, dst, paint);
121 } 127 }
122 128
123 bool SkImage_Raster::onReadPixels(SkBitmap* dst, const SkIRect& subset) const { 129 bool SkImage_Raster::onReadPixels(SkBitmap* dst, const SkIRect& subset) const {
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 } 196 }
191 197
192 SkImage* SkNewImageFromPixelRef(const SkImageInfo& info, SkPixelRef* pr, 198 SkImage* SkNewImageFromPixelRef(const SkImageInfo& info, SkPixelRef* pr,
193 size_t rowBytes) { 199 size_t rowBytes) {
194 return SkNEW_ARGS(SkImage_Raster, (info, pr, rowBytes)); 200 return SkNEW_ARGS(SkImage_Raster, (info, pr, rowBytes));
195 } 201 }
196 202
197 SkPixelRef* SkBitmapImageGetPixelRef(SkImage* image) { 203 SkPixelRef* SkBitmapImageGetPixelRef(SkImage* image) {
198 return ((SkImage_Raster*)image)->getPixelRef(); 204 return ((SkImage_Raster*)image)->getPixelRef();
199 } 205 }
OLDNEW
« no previous file with comments | « src/image/SkImage_Gpu.cpp ('k') | tests/ImageNewShaderTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698