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

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

Issue 1309943004: Revert of 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 bool SkBitmapProcShader::onIsABitmap(SkBitmap* texture, SkMatrix* texM, TileMode xy[]) const { 30 SkShader::BitmapType SkBitmapProcShader::asABitmap(SkBitmap* texture,
31 SkMatrix* texM,
32 TileMode xy[]) const {
31 if (texture) { 33 if (texture) {
32 *texture = fRawBitmap; 34 *texture = fRawBitmap;
33 } 35 }
34 if (texM) { 36 if (texM) {
35 texM->reset(); 37 texM->reset();
36 } 38 }
37 if (xy) { 39 if (xy) {
38 xy[0] = (TileMode)fTileModeX; 40 xy[0] = (TileMode)fTileModeX;
39 xy[1] = (TileMode)fTileModeY; 41 xy[1] = (TileMode)fTileModeY;
40 } 42 }
41 return true; 43 return kDefault_BitmapType;
42 } 44 }
43 45
44 SkFlattenable* SkBitmapProcShader::CreateProc(SkReadBuffer& buffer) { 46 SkFlattenable* SkBitmapProcShader::CreateProc(SkReadBuffer& buffer) {
45 SkMatrix lm; 47 SkMatrix lm;
46 buffer.readMatrix(&lm); 48 buffer.readMatrix(&lm);
47 SkBitmap bm; 49 SkBitmap bm;
48 if (!buffer.readBitmap(&bm)) { 50 if (!buffer.readBitmap(&bm)) {
49 return nullptr; 51 return nullptr;
50 } 52 }
51 bm.setImmutable(); 53 bm.setImmutable();
(...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after
401 inner.reset(GrSimpleTextureEffect::Create(procDataManager, texture, matr ix, params)); 403 inner.reset(GrSimpleTextureEffect::Create(procDataManager, texture, matr ix, params));
402 } 404 }
403 405
404 if (kAlpha_8_SkColorType == fRawBitmap.colorType()) { 406 if (kAlpha_8_SkColorType == fRawBitmap.colorType()) {
405 return SkRef(inner.get()); 407 return SkRef(inner.get());
406 } 408 }
407 return GrExtractAlphaFragmentProcessor::Create(inner); 409 return GrExtractAlphaFragmentProcessor::Create(inner);
408 } 410 }
409 411
410 #endif 412 #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