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

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

Issue 2029373004: respect srgb gamma when building mips (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fix warning Created 4 years, 6 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 Clamp_SI8_opaque_D32_filter_DX_shaderproc_neon(const void*, int, in t, uint32_t*, int); 30 extern void Clamp_SI8_opaque_D32_filter_DX_shaderproc_neon(const void*, int, in t, uint32_t*, int);
31 #endif 31 #endif
32 32
33 extern void Clamp_S32_opaque_D32_nofilter_DX_shaderproc(const void*, int, int, u int32_t*, int); 33 extern void Clamp_S32_opaque_D32_nofilter_DX_shaderproc(const void*, int, int, u int32_t*, int);
34 34
35 #define NAME_WRAP(x) x 35 #define NAME_WRAP(x) x
36 #include "SkBitmapProcState_filter.h" 36 #include "SkBitmapProcState_filter.h"
37 #include "SkBitmapProcState_procs.h" 37 #include "SkBitmapProcState_procs.h"
38 38
39 SkBitmapProcInfo::SkBitmapProcInfo(const SkBitmapProvider& provider, 39 SkBitmapProcInfo::SkBitmapProcInfo(const SkBitmapProvider& provider,
40 SkShader::TileMode tmx, SkShader::TileMode tm y) 40 SkShader::TileMode tmx, SkShader::TileMode tm y,
41 SkSourceGammaTreatment treatment)
41 : fProvider(provider) 42 : fProvider(provider)
42 , fTileModeX(tmx) 43 , fTileModeX(tmx)
43 , fTileModeY(tmy) 44 , fTileModeY(tmy)
45 , fSrcGammaTreatment(treatment)
44 , fBMState(nullptr) 46 , fBMState(nullptr)
45 {} 47 {}
46 48
47 SkBitmapProcInfo::SkBitmapProcInfo(const SkBitmap& bm, 49 SkBitmapProcInfo::SkBitmapProcInfo(const SkBitmap& bm,
48 SkShader::TileMode tmx, SkShader::TileMode tm y) 50 SkShader::TileMode tmx, SkShader::TileMode tm y,
51 SkSourceGammaTreatment treatment)
49 : fProvider(SkBitmapProvider(bm)) 52 : fProvider(SkBitmapProvider(bm))
50 , fTileModeX(tmx) 53 , fTileModeX(tmx)
51 , fTileModeY(tmy) 54 , fTileModeY(tmy)
55 , fSrcGammaTreatment(treatment)
52 , fBMState(nullptr) 56 , fBMState(nullptr)
53 {} 57 {}
54 58
55 SkBitmapProcInfo::~SkBitmapProcInfo() { 59 SkBitmapProcInfo::~SkBitmapProcInfo() {
56 SkInPlaceDeleteCheck(fBMState, fBMStateStorage.get()); 60 SkInPlaceDeleteCheck(fBMState, fBMStateStorage.get());
57 } 61 }
58 62
59 /////////////////////////////////////////////////////////////////////////////// 63 ///////////////////////////////////////////////////////////////////////////////
60 64
61 // true iff the matrix contains, at most, scale and translate elements 65 // true iff the matrix contains, at most, scale and translate elements
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 126
123 fPixmap.reset(); 127 fPixmap.reset();
124 fInvMatrix = inv; 128 fInvMatrix = inv;
125 fFilterQuality = paint.getFilterQuality(); 129 fFilterQuality = paint.getFilterQuality();
126 130
127 bool allow_ignore_fractional_translate = true; // historical default 131 bool allow_ignore_fractional_translate = true; // historical default
128 if (kMedium_SkFilterQuality == fFilterQuality) { 132 if (kMedium_SkFilterQuality == fFilterQuality) {
129 allow_ignore_fractional_translate = false; 133 allow_ignore_fractional_translate = false;
130 } 134 }
131 135
132 SkDefaultBitmapController controller; 136 SkDefaultBitmapController controller(fSrcGammaTreatment);
133 fBMState = controller.requestBitmap(fProvider, inv, paint.getFilterQuality() , 137 fBMState = controller.requestBitmap(fProvider, inv, paint.getFilterQuality() ,
134 fBMStateStorage.get(), fBMStateStorage.s ize()); 138 fBMStateStorage.get(), fBMStateStorage.s ize());
135 // Note : we allow the controller to return an empty (zero-dimension) result . Should we? 139 // Note : we allow the controller to return an empty (zero-dimension) result . Should we?
136 if (nullptr == fBMState || fBMState->pixmap().info().isEmpty()) { 140 if (nullptr == fBMState || fBMState->pixmap().info().isEmpty()) {
137 return false; 141 return false;
138 } 142 }
139 fPixmap = fBMState->pixmap(); 143 fPixmap = fBMState->pixmap();
140 fInvMatrix = fBMState->invMatrix(); 144 fInvMatrix = fBMState->invMatrix();
141 fRealInvMatrix = fBMState->invMatrix(); 145 fRealInvMatrix = fBMState->invMatrix();
142 fPaintColor = paint.getColor(); 146 fPaintColor = paint.getColor();
(...skipping 674 matching lines...) Expand 10 before | Expand all | Expand 10 after
817 *dst++ = src[index]; 821 *dst++ = src[index];
818 fx += dx; 822 fx += dx;
819 } 823 }
820 } else { 824 } else {
821 for (int i = 0; i < count; ++i) { 825 for (int i = 0; i < count; ++i) {
822 dst[i] = src[SkClampMax(SkFractionalIntToInt(fx), maxX)]; 826 dst[i] = src[SkClampMax(SkFractionalIntToInt(fx), maxX)];
823 fx += dx; 827 fx += dx;
824 } 828 }
825 } 829 }
826 } 830 }
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