Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2011 Google Inc. | 3 * Copyright 2011 Google Inc. |
| 4 * | 4 * |
| 5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
| 6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
| 7 */ | 7 */ |
| 8 #include "SkColorPriv.h" | 8 #include "SkColorPriv.h" |
| 9 #include "SkReadBuffer.h" | 9 #include "SkReadBuffer.h" |
| 10 #include "SkWriteBuffer.h" | 10 #include "SkWriteBuffer.h" |
| (...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 198 | 198 |
| 199 fFlags = flags; | 199 fFlags = flags; |
| 200 } | 200 } |
| 201 | 201 |
| 202 SkBitmapProcShader::BitmapProcShaderContext::~BitmapProcShaderContext() { | 202 SkBitmapProcShader::BitmapProcShaderContext::~BitmapProcShaderContext() { |
| 203 // The bitmap proc state has been created outside of the context on memory t hat will be freed | 203 // The bitmap proc state has been created outside of the context on memory t hat will be freed |
| 204 // elsewhere. Only call the destructor but leave the freeing of the memory t o the caller. | 204 // elsewhere. Only call the destructor but leave the freeing of the memory t o the caller. |
| 205 fState->~SkBitmapProcState(); | 205 fState->~SkBitmapProcState(); |
| 206 } | 206 } |
| 207 | 207 |
| 208 #define BUF_MAX 128 | 208 /* Defines the buffer size for sample pixel indexes, used in the sample proc fun ction calls. |
| 209 * If the operation is bigger than the buffer, it's split into multiple calls. T his split is bad | |
| 210 * for the performance of SIMD optimizations. | |
| 211 * A display in portrait mode, with a width of 720 pixels, requires a buffer siz e of at least 361 | |
| 212 * to run uninterrupted in the most basic operations. (Formula: Width / 2 + 1) | |
| 213 */ | |
| 214 #ifdef ANDROID_LARGE_MEMORY_DEVICE | |
|
djsollen
2014/04/23 14:40:53
my goal is to remove ANDROID_LARGE_MEMORY_DEVICE s
henrik.smiding
2014/04/23 15:20:21
Done.
| |
| 215 #define BUF_MAX 541 // 1080p phone display | |
| 216 #else | |
| 217 #define BUF_MAX 241 // 480p phone display | |
| 218 #endif | |
| 209 | 219 |
| 210 #define TEST_BUFFER_OVERRITEx | 220 #define TEST_BUFFER_OVERRITEx |
| 211 | 221 |
| 212 #ifdef TEST_BUFFER_OVERRITE | 222 #ifdef TEST_BUFFER_OVERRITE |
| 213 #define TEST_BUFFER_EXTRA 32 | 223 #define TEST_BUFFER_EXTRA 32 |
| 214 #define TEST_PATTERN 0x88888888 | 224 #define TEST_PATTERN 0x88888888 |
| 215 #else | 225 #else |
| 216 #define TEST_BUFFER_EXTRA 0 | 226 #define TEST_BUFFER_EXTRA 0 |
| 217 #endif | 227 #endif |
| 218 | 228 |
| 219 void SkBitmapProcShader::BitmapProcShaderContext::shadeSpan(int x, int y, SkPMCo lor dstC[], | 229 void SkBitmapProcShader::BitmapProcShaderContext::shadeSpan(int x, int y, SkPMCo lor dstC[], |
| 220 int count) { | 230 int count) { |
| 221 const SkBitmapProcState& state = *fState; | 231 const SkBitmapProcState& state = *fState; |
| 222 if (state.getShaderProc32()) { | 232 if (state.getShaderProc32()) { |
| 223 state.getShaderProc32()(state, x, y, dstC, count); | 233 state.getShaderProc32()(state, x, y, dstC, count); |
| 224 return; | 234 return; |
| 225 } | 235 } |
| 226 | 236 |
| 227 uint32_t buffer[BUF_MAX + TEST_BUFFER_EXTRA]; | 237 // Align buffer to 16 bytes to enable more efficient SIMD optimizations. |
| 238 uint32_t SK_ALIGN(16) buffer[BUF_MAX + TEST_BUFFER_EXTRA]; | |
| 239 | |
| 228 SkBitmapProcState::MatrixProc mproc = state.getMatrixProc(); | 240 SkBitmapProcState::MatrixProc mproc = state.getMatrixProc(); |
| 229 SkBitmapProcState::SampleProc32 sproc = state.getSampleProc32(); | 241 SkBitmapProcState::SampleProc32 sproc = state.getSampleProc32(); |
| 230 int max = state.maxCountForBufferSize(sizeof(buffer[0]) * BUF_MAX); | 242 int max = state.maxCountForBufferSize(sizeof(buffer[0]) * BUF_MAX); |
| 231 | 243 |
| 232 SkASSERT(state.fBitmap->getPixels()); | 244 SkASSERT(state.fBitmap->getPixels()); |
| 233 SkASSERT(state.fBitmap->pixelRef() == NULL || | 245 SkASSERT(state.fBitmap->pixelRef() == NULL || |
| 234 state.fBitmap->pixelRef()->isLocked()); | 246 state.fBitmap->pixelRef()->isLocked()); |
| 235 | 247 |
| 236 for (;;) { | 248 for (;;) { |
| 237 int n = count; | 249 int n = count; |
| (...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 486 GrEffectRef* effect = NULL; | 498 GrEffectRef* effect = NULL; |
| 487 if (paintFilterLevel == SkPaint::kHigh_FilterLevel) { | 499 if (paintFilterLevel == SkPaint::kHigh_FilterLevel) { |
| 488 effect = GrBicubicEffect::Create(texture, matrix, tm); | 500 effect = GrBicubicEffect::Create(texture, matrix, tm); |
| 489 } else { | 501 } else { |
| 490 effect = GrSimpleTextureEffect::Create(texture, matrix, params); | 502 effect = GrSimpleTextureEffect::Create(texture, matrix, params); |
| 491 } | 503 } |
| 492 GrUnlockAndUnrefCachedBitmapTexture(texture); | 504 GrUnlockAndUnrefCachedBitmapTexture(texture); |
| 493 return effect; | 505 return effect; |
| 494 } | 506 } |
| 495 #endif | 507 #endif |
| OLD | NEW |