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

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

Issue 1149773005: Add direct getter for GrCaps to GrContext. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: init caps in the right place Created 5 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 | « include/gpu/GrContext.h ('k') | src/effects/SkAlphaThresholdFilter.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 2014 Google Inc. 2 * Copyright 2014 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 "SkPictureShader.h" 8 #include "SkPictureShader.h"
9 9
10 #include "SkBitmap.h" 10 #include "SkBitmap.h"
11 #include "SkBitmapProcShader.h" 11 #include "SkBitmapProcShader.h"
12 #include "SkCanvas.h" 12 #include "SkCanvas.h"
13 #include "SkMatrixUtils.h" 13 #include "SkMatrixUtils.h"
14 #include "SkPicture.h" 14 #include "SkPicture.h"
15 #include "SkReadBuffer.h" 15 #include "SkReadBuffer.h"
16 #include "SkResourceCache.h" 16 #include "SkResourceCache.h"
17 17
18 #if SK_SUPPORT_GPU 18 #if SK_SUPPORT_GPU
19 #include "GrContext.h" 19 #include "GrContext.h"
20 #include "GrCaps.h"
20 #endif 21 #endif
21 22
22 namespace { 23 namespace {
23 static unsigned gBitmapSkaderKeyNamespaceLabel; 24 static unsigned gBitmapSkaderKeyNamespaceLabel;
24 25
25 struct BitmapShaderKey : public SkResourceCache::Key { 26 struct BitmapShaderKey : public SkResourceCache::Key {
26 public: 27 public:
27 BitmapShaderKey(uint32_t pictureID, 28 BitmapShaderKey(uint32_t pictureID,
28 const SkRect& tile, 29 const SkRect& tile,
29 SkShader::TileMode tmx, 30 SkShader::TileMode tmx,
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after
338 } 339 }
339 #endif 340 #endif
340 341
341 #if SK_SUPPORT_GPU 342 #if SK_SUPPORT_GPU
342 bool SkPictureShader::asFragmentProcessor(GrContext* context, const SkPaint& pai nt, 343 bool SkPictureShader::asFragmentProcessor(GrContext* context, const SkPaint& pai nt,
343 const SkMatrix& viewM, const SkMatrix* localMatrix, 344 const SkMatrix& viewM, const SkMatrix* localMatrix,
344 GrColor* paintColor, 345 GrColor* paintColor,
345 GrFragmentProcessor** fp) const { 346 GrFragmentProcessor** fp) const {
346 int maxTextureSize = 0; 347 int maxTextureSize = 0;
347 if (context) { 348 if (context) {
348 maxTextureSize = context->getMaxTextureSize(); 349 maxTextureSize = context->caps()->maxTextureSize();
349 } 350 }
350 SkAutoTUnref<SkShader> bitmapShader(this->refBitmapShader(viewM, localMatrix , maxTextureSize)); 351 SkAutoTUnref<SkShader> bitmapShader(this->refBitmapShader(viewM, localMatrix , maxTextureSize));
351 if (!bitmapShader) { 352 if (!bitmapShader) {
352 return false; 353 return false;
353 } 354 }
354 return bitmapShader->asFragmentProcessor(context, paint, viewM, NULL, paintC olor, fp); 355 return bitmapShader->asFragmentProcessor(context, paint, viewM, NULL, paintC olor, fp);
355 } 356 }
356 #else 357 #else
357 bool SkPictureShader::asFragmentProcessor(GrContext*, const SkPaint&, const SkMa trix&, 358 bool SkPictureShader::asFragmentProcessor(GrContext*, const SkPaint&, const SkMa trix&,
358 const SkMatrix*, GrColor*, 359 const SkMatrix*, GrColor*,
359 GrFragmentProcessor**) const { 360 GrFragmentProcessor**) const {
360 SkDEBUGFAIL("Should not call in GPU-less build"); 361 SkDEBUGFAIL("Should not call in GPU-less build");
361 return false; 362 return false;
362 } 363 }
363 #endif 364 #endif
OLDNEW
« no previous file with comments | « include/gpu/GrContext.h ('k') | src/effects/SkAlphaThresholdFilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698