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

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

Issue 2043393002: Refactoring of GPU NormalMap handling out into its own class (Closed) Base URL: https://skia.googlesource.com/skia@master
Patch Set: Fixed SK_API flags, got rid of NormalMapSource::Make 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/SkBitmapProcShader.h ('k') | src/core/SkLightingShader.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 "SkBitmapProvider.h" 10 #include "SkBitmapProvider.h"
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after
298 buffer.writeMatrix(this->getLocalMatrix()); 298 buffer.writeMatrix(this->getLocalMatrix());
299 buffer.writeBitmap(fRawBitmap); 299 buffer.writeBitmap(fRawBitmap);
300 buffer.writeUInt(fTileModeX); 300 buffer.writeUInt(fTileModeX);
301 buffer.writeUInt(fTileModeY); 301 buffer.writeUInt(fTileModeY);
302 } 302 }
303 303
304 bool SkBitmapProcShader::isOpaque() const { 304 bool SkBitmapProcShader::isOpaque() const {
305 return fRawBitmap.isOpaque(); 305 return fRawBitmap.isOpaque();
306 } 306 }
307 307
308 bool SkBitmapProcShader::BitmapIsTooBig(const SkBitmap& bm) {
309 static const int kMaxSize = 65535;
310
311 return bm.width() > kMaxSize || bm.height() > kMaxSize;
312 }
313
308 //////////////////////////////////////////////////////////////////////////////// /////////////////// 314 //////////////////////////////////////////////////////////////////////////////// ///////////////////
309 315
310 #include "SkUnPreMultiply.h" 316 #include "SkUnPreMultiply.h"
311 #include "SkColorShader.h" 317 #include "SkColorShader.h"
312 #include "SkEmptyShader.h" 318 #include "SkEmptyShader.h"
313 319
314 // returns true and set color if the bitmap can be drawn as a single color 320 // returns true and set color if the bitmap can be drawn as a single color
315 // (for efficiency) 321 // (for efficiency)
316 static bool can_use_color_shader(const SkBitmap& bm, SkColor* color) { 322 static bool can_use_color_shader(const SkBitmap& bm, SkColor* color) {
317 #ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK 323 #ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
462 inner = GrSimpleTextureEffect::Make(texture, matrix, params); 468 inner = GrSimpleTextureEffect::Make(texture, matrix, params);
463 } 469 }
464 470
465 if (kAlpha_8_SkColorType == fRawBitmap.colorType()) { 471 if (kAlpha_8_SkColorType == fRawBitmap.colorType()) {
466 return GrFragmentProcessor::MulOutputByInputUnpremulColor(std::move(inne r)); 472 return GrFragmentProcessor::MulOutputByInputUnpremulColor(std::move(inne r));
467 } 473 }
468 return GrFragmentProcessor::MulOutputByInputAlpha(std::move(inner)); 474 return GrFragmentProcessor::MulOutputByInputAlpha(std::move(inner));
469 } 475 }
470 476
471 #endif 477 #endif
OLDNEW
« no previous file with comments | « src/core/SkBitmapProcShader.h ('k') | src/core/SkLightingShader.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698