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

Side by Side Diff: src/effects/SkLightingImageFilter.cpp

Issue 1918003003: Bring sk_sp to GrDrawContext (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: update Created 4 years, 8 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
OLDNEW
1 /* 1 /*
2 * Copyright 2012 The Android Open Source Project 2 * Copyright 2012 The Android Open Source Project
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 "SkLightingImageFilter.h" 8 #include "SkLightingImageFilter.h"
9 #include "SkBitmap.h" 9 #include "SkBitmap.h"
10 #include "SkColorPriv.h" 10 #include "SkColorPriv.h"
(...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after
411 desc.fFlags = kRenderTarget_GrSurfaceFlag, 411 desc.fFlags = kRenderTarget_GrSurfaceFlag,
412 desc.fWidth = offsetBounds.width(); 412 desc.fWidth = offsetBounds.width();
413 desc.fHeight = offsetBounds.height(); 413 desc.fHeight = offsetBounds.height();
414 desc.fConfig = kRGBA_8888_GrPixelConfig; 414 desc.fConfig = kRGBA_8888_GrPixelConfig;
415 415
416 sk_sp<GrTexture> dst(context->textureProvider()->createApproxTexture(desc)); 416 sk_sp<GrTexture> dst(context->textureProvider()->createApproxTexture(desc));
417 if (!dst) { 417 if (!dst) {
418 return nullptr; 418 return nullptr;
419 } 419 }
420 420
421 sk_sp<GrDrawContext> drawContext(context->drawContext(dst->asRenderTarget()) ); 421 sk_sp<GrDrawContext> drawContext(context->drawContext(sk_ref_sp(dst->asRende rTarget())));
422 if (!drawContext) { 422 if (!drawContext) {
423 return nullptr; 423 return nullptr;
424 } 424 }
425 425
426 SkRect dstRect = SkRect::MakeWH(SkIntToScalar(offsetBounds.width()), 426 SkRect dstRect = SkRect::MakeWH(SkIntToScalar(offsetBounds.width()),
427 SkIntToScalar(offsetBounds.height())); 427 SkIntToScalar(offsetBounds.height()));
428 428
429 // setup new clip 429 // setup new clip
430 GrClip clip(dstRect); 430 GrClip clip(dstRect);
431 431
(...skipping 1739 matching lines...) Expand 10 before | Expand all | Expand 10 after
2171 2171
2172 fragBuilder->codeAppendf("%s(%s)", fLightColorFunc.c_str(), surfaceToLight); 2172 fragBuilder->codeAppendf("%s(%s)", fLightColorFunc.c_str(), surfaceToLight);
2173 } 2173 }
2174 2174
2175 #endif 2175 #endif
2176 2176
2177 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkLightingImageFilter) 2177 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkLightingImageFilter)
2178 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkDiffuseLightingImageFilter) 2178 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkDiffuseLightingImageFilter)
2179 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkSpecularLightingImageFilter) 2179 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkSpecularLightingImageFilter)
2180 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END 2180 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698