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

Side by Side Diff: src/core/SkBitmapProcShader.cpp

Issue 1311963007: switch to isABitmap, deprecate SK_SUPPORT_LEGACY_SHADERBITMAPTYPE (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 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 | « src/core/SkBitmapProcShader.h ('k') | src/core/SkLocalMatrixShader.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 2011 Google Inc. 2 * Copyright 2011 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 "SkBitmapProcShader.h" 8 #include "SkBitmapProcShader.h"
9 #include "SkBitmapProcState.h" 9 #include "SkBitmapProcState.h"
10 #include "SkColorPriv.h" 10 #include "SkColorPriv.h"
11 #include "SkErrorInternals.h" 11 #include "SkErrorInternals.h"
12 #include "SkPixelRef.h" 12 #include "SkPixelRef.h"
13 #include "SkReadBuffer.h" 13 #include "SkReadBuffer.h"
14 #include "SkWriteBuffer.h" 14 #include "SkWriteBuffer.h"
15 15
16 #if SK_SUPPORT_GPU 16 #if SK_SUPPORT_GPU
17 #include "effects/GrBicubicEffect.h" 17 #include "effects/GrBicubicEffect.h"
18 #include "effects/GrExtractAlphaFragmentProcessor.h" 18 #include "effects/GrExtractAlphaFragmentProcessor.h"
19 #include "effects/GrSimpleTextureEffect.h" 19 #include "effects/GrSimpleTextureEffect.h"
20 #endif 20 #endif
21 21
22 SkBitmapProcShader::SkBitmapProcShader(const SkBitmap& src, TileMode tmx, TileMo de tmy, 22 SkBitmapProcShader::SkBitmapProcShader(const SkBitmap& src, TileMode tmx, TileMo de tmy,
23 const SkMatrix* localMatrix) 23 const SkMatrix* localMatrix)
24 : INHERITED(localMatrix) { 24 : INHERITED(localMatrix) {
25 fRawBitmap = src; 25 fRawBitmap = src;
26 fTileModeX = (uint8_t)tmx; 26 fTileModeX = (uint8_t)tmx;
27 fTileModeY = (uint8_t)tmy; 27 fTileModeY = (uint8_t)tmy;
28 } 28 }
29 29
30 SkShader::BitmapType SkBitmapProcShader::asABitmap(SkBitmap* texture, 30 bool SkBitmapProcShader::onIsABitmap(SkBitmap* texture, SkMatrix* texM, TileMode xy[]) const {
31 SkMatrix* texM,
32 TileMode xy[]) const {
33 if (texture) { 31 if (texture) {
34 *texture = fRawBitmap; 32 *texture = fRawBitmap;
35 } 33 }
36 if (texM) { 34 if (texM) {
37 texM->reset(); 35 texM->reset();
38 } 36 }
39 if (xy) { 37 if (xy) {
40 xy[0] = (TileMode)fTileModeX; 38 xy[0] = (TileMode)fTileModeX;
41 xy[1] = (TileMode)fTileModeY; 39 xy[1] = (TileMode)fTileModeY;
42 } 40 }
43 return kDefault_BitmapType; 41 return true;
44 } 42 }
45 43
46 SkFlattenable* SkBitmapProcShader::CreateProc(SkReadBuffer& buffer) { 44 SkFlattenable* SkBitmapProcShader::CreateProc(SkReadBuffer& buffer) {
47 SkMatrix lm; 45 SkMatrix lm;
48 buffer.readMatrix(&lm); 46 buffer.readMatrix(&lm);
49 SkBitmap bm; 47 SkBitmap bm;
50 if (!buffer.readBitmap(&bm)) { 48 if (!buffer.readBitmap(&bm)) {
51 return nullptr; 49 return nullptr;
52 } 50 }
53 bm.setImmutable(); 51 bm.setImmutable();
(...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after
403 inner.reset(GrSimpleTextureEffect::Create(procDataManager, texture, matr ix, params)); 401 inner.reset(GrSimpleTextureEffect::Create(procDataManager, texture, matr ix, params));
404 } 402 }
405 403
406 if (kAlpha_8_SkColorType == fRawBitmap.colorType()) { 404 if (kAlpha_8_SkColorType == fRawBitmap.colorType()) {
407 return SkRef(inner.get()); 405 return SkRef(inner.get());
408 } 406 }
409 return GrExtractAlphaFragmentProcessor::Create(inner); 407 return GrExtractAlphaFragmentProcessor::Create(inner);
410 } 408 }
411 409
412 #endif 410 #endif
OLDNEW
« no previous file with comments | « src/core/SkBitmapProcShader.h ('k') | src/core/SkLocalMatrixShader.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698