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

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

Issue 1343123005: use SkBitmapProvider for shader-context (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: restore privacy 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/SkBitmapProcState.h ('k') | src/core/SkLightingShader.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 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 "SkBitmapCache.h" 8 #include "SkBitmapCache.h"
9 #include "SkBitmapController.h" 9 #include "SkBitmapController.h"
10 #include "SkBitmapProcState.h" 10 #include "SkBitmapProcState.h"
(...skipping 19 matching lines...) Expand all
30 extern void SI8_opaque_D32_filter_DX_shaderproc_neon(const SkBitmapProcState&, int, int, uint32_t*, int); 30 extern void SI8_opaque_D32_filter_DX_shaderproc_neon(const SkBitmapProcState&, int, int, uint32_t*, int);
31 extern void Clamp_SI8_opaque_D32_filter_DX_shaderproc_neon(const SkBitmapProcSt ate&, int, int, uint32_t*, int); 31 extern void Clamp_SI8_opaque_D32_filter_DX_shaderproc_neon(const SkBitmapProcSt ate&, int, int, uint32_t*, int);
32 #endif 32 #endif
33 33
34 extern void Clamp_S32_opaque_D32_nofilter_DX_shaderproc(const SkBitmapProcState& , int, int, uint32_t*, int); 34 extern void Clamp_S32_opaque_D32_nofilter_DX_shaderproc(const SkBitmapProcState& , int, int, uint32_t*, int);
35 35
36 #define NAME_WRAP(x) x 36 #define NAME_WRAP(x) x
37 #include "SkBitmapProcState_filter.h" 37 #include "SkBitmapProcState_filter.h"
38 #include "SkBitmapProcState_procs.h" 38 #include "SkBitmapProcState_procs.h"
39 39
40 SkBitmapProcState::SkBitmapProcState() : fBMState(nullptr) {} 40 SkBitmapProcState::SkBitmapProcState(const SkBitmapProvider& provider,
41 SkShader::TileMode tmx, SkShader::TileMode tmy)
42 : fProvider(provider)
43 , fBMState(nullptr)
44 {
45 fTileModeX = tmx;
46 fTileModeY = tmy;
47 }
48
49 SkBitmapProcState::SkBitmapProcState(const SkBitmap& bm,
50 SkShader::TileMode tmx, SkShader::TileMode tmy)
51 : fProvider(SkBitmapProvider(bm))
52 , fBMState(nullptr)
53 {
54 fTileModeX = tmx;
55 fTileModeY = tmy;
56 }
41 57
42 SkBitmapProcState::~SkBitmapProcState() { 58 SkBitmapProcState::~SkBitmapProcState() {
43 SkInPlaceDeleteCheck(fBMState, fBMStateStorage.get()); 59 SkInPlaceDeleteCheck(fBMState, fBMStateStorage.get());
44 } 60 }
45 61
46 /////////////////////////////////////////////////////////////////////////////// 62 ///////////////////////////////////////////////////////////////////////////////
47 63
48 // true iff the matrix contains, at most, scale and translate elements 64 // true iff the matrix contains, at most, scale and translate elements
49 static bool matrix_only_scale_translate(const SkMatrix& m) { 65 static bool matrix_only_scale_translate(const SkMatrix& m) {
50 return m.getType() <= (SkMatrix::kScale_Mask | SkMatrix::kTranslate_Mask); 66 return m.getType() <= (SkMatrix::kScale_Mask | SkMatrix::kTranslate_Mask);
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 * We can always fulfill requests for Low and None 128 * We can always fulfill requests for Low and None
113 * - sometimes we will "ignore" Low and give None, but this is likely a legacy perf hack 129 * - sometimes we will "ignore" Low and give None, but this is likely a legacy perf hack
114 * and may be removed. 130 * and may be removed.
115 */ 131 */
116 bool SkBitmapProcState::chooseProcs(const SkMatrix& inv, const SkPaint& paint) { 132 bool SkBitmapProcState::chooseProcs(const SkMatrix& inv, const SkPaint& paint) {
117 fPixmap.reset(); 133 fPixmap.reset();
118 fInvMatrix = inv; 134 fInvMatrix = inv;
119 fFilterLevel = paint.getFilterQuality(); 135 fFilterLevel = paint.getFilterQuality();
120 136
121 SkDefaultBitmapController controller; 137 SkDefaultBitmapController controller;
122 fBMState = controller.requestBitmap(fOrigBitmap, inv, paint.getFilterQuality (), 138 fBMState = controller.requestBitmap(fProvider, inv, paint.getFilterQuality() ,
123 fBMStateStorage.get(), fBMStateStorage.s ize()); 139 fBMStateStorage.get(), fBMStateStorage.s ize());
124 // Note : we allow the controller to return an empty (zero-dimension) result . Should we? 140 // Note : we allow the controller to return an empty (zero-dimension) result . Should we?
125 if (nullptr == fBMState || fBMState->pixmap().info().isEmpty()) { 141 if (nullptr == fBMState || fBMState->pixmap().info().isEmpty()) {
126 return false; 142 return false;
127 } 143 }
128 fPixmap = fBMState->pixmap(); 144 fPixmap = fBMState->pixmap();
129 fInvMatrix = fBMState->invMatrix(); 145 fInvMatrix = fBMState->invMatrix();
130 fFilterLevel = fBMState->quality(); 146 fFilterLevel = fBMState->quality();
131 SkASSERT(fPixmap.addr()); 147 SkASSERT(fPixmap.addr());
132 148
(...skipping 707 matching lines...) Expand 10 before | Expand all | Expand 10 after
840 fx += dx; 856 fx += dx;
841 } 857 }
842 } else { 858 } else {
843 for (int i = 0; i < count; ++i) { 859 for (int i = 0; i < count; ++i) {
844 dst[i] = src[SkClampMax(SkFractionalIntToInt(fx), maxX)]; 860 dst[i] = src[SkClampMax(SkFractionalIntToInt(fx), maxX)];
845 fx += dx; 861 fx += dx;
846 } 862 }
847 } 863 }
848 } 864 }
849 865
OLDNEW
« no previous file with comments | « src/core/SkBitmapProcState.h ('k') | src/core/SkLightingShader.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698