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

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

Issue 1342113002: add ImageShader, sharing code with its Bitmap cousin (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rebase Created 5 years, 3 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 | « gyp/core.gypi ('k') | src/image/SkImageShader.h » ('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 "SkBitmap.h" 8 #include "SkBitmap.h"
9 #include "SkBitmapCache.h" 9 #include "SkBitmapCache.h"
10 #include "SkCanvas.h" 10 #include "SkCanvas.h"
11 #include "SkData.h" 11 #include "SkData.h"
12 #include "SkImageGenerator.h" 12 #include "SkImageGenerator.h"
13 #include "SkImagePriv.h" 13 #include "SkImagePriv.h"
14 #include "SkImageShader.h"
14 #include "SkImage_Base.h" 15 #include "SkImage_Base.h"
15 #include "SkNextID.h" 16 #include "SkNextID.h"
16 #include "SkPixelRef.h" 17 #include "SkPixelRef.h"
17 #include "SkPixelSerializer.h" 18 #include "SkPixelSerializer.h"
18 #include "SkReadPixelsRec.h" 19 #include "SkReadPixelsRec.h"
19 #include "SkString.h" 20 #include "SkString.h"
20 #include "SkSurface.h" 21 #include "SkSurface.h"
21 22
22 #if SK_SUPPORT_GPU 23 #if SK_SUPPORT_GPU
23 #include "GrTexture.h" 24 #include "GrTexture.h"
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 SkBitmap bm; 63 SkBitmap bm;
63 if (as_IB(this)->getROPixels(&bm)) { 64 if (as_IB(this)->getROPixels(&bm)) {
64 bm.lockPixels(); 65 bm.lockPixels();
65 bm.unlockPixels(); 66 bm.unlockPixels();
66 } 67 }
67 } 68 }
68 69
69 SkShader* SkImage::newShader(SkShader::TileMode tileX, 70 SkShader* SkImage::newShader(SkShader::TileMode tileX,
70 SkShader::TileMode tileY, 71 SkShader::TileMode tileY,
71 const SkMatrix* localMatrix) const { 72 const SkMatrix* localMatrix) const {
72 return as_IB(this)->onNewShader(tileX, tileY, localMatrix); 73 return SkImageShader::Create(this, tileX, tileY, localMatrix);
73 } 74 }
74 75
75 SkData* SkImage::encode(SkImageEncoder::Type type, int quality) const { 76 SkData* SkImage::encode(SkImageEncoder::Type type, int quality) const {
76 SkBitmap bm; 77 SkBitmap bm;
77 if (as_IB(this)->getROPixels(&bm)) { 78 if (as_IB(this)->getROPixels(&bm)) {
78 return SkImageEncoder::EncodeData(bm, type, quality); 79 return SkImageEncoder::EncodeData(bm, type, quality);
79 } 80 }
80 return nullptr; 81 return nullptr;
81 } 82 }
82 83
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after
365 366
366 SkImage* SkImage::NewFromAdoptedTexture(GrContext*, const GrBackendTextureDesc&, SkAlphaType) { 367 SkImage* SkImage::NewFromAdoptedTexture(GrContext*, const GrBackendTextureDesc&, SkAlphaType) {
367 return nullptr; 368 return nullptr;
368 } 369 }
369 370
370 SkImage* SkImage::NewFromTextureCopy(GrContext*, const GrBackendTextureDesc&, Sk AlphaType) { 371 SkImage* SkImage::NewFromTextureCopy(GrContext*, const GrBackendTextureDesc&, Sk AlphaType) {
371 return nullptr; 372 return nullptr;
372 } 373 }
373 374
374 #endif 375 #endif
OLDNEW
« no previous file with comments | « gyp/core.gypi ('k') | src/image/SkImageShader.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698