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

Unified Diff: samplecode/SampleAll.cpp

Issue 1852113003: switch maskfilters to sk_sp (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « public.bzl ('k') | samplecode/SampleAnimBlur.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: samplecode/SampleAll.cpp
diff --git a/samplecode/SampleAll.cpp b/samplecode/SampleAll.cpp
index aa0826120038ef20f26560608c3bf5c8f1936f8c..357a437a67acee1a775c59139f589028bf67b3e9 100644
--- a/samplecode/SampleAll.cpp
+++ b/samplecode/SampleAll.cpp
@@ -77,9 +77,9 @@ private:
///////////////////////////////////////////////////////////
static void r0(SkLayerRasterizer::Builder* rastBuilder, SkPaint& p) {
- p.setMaskFilter(SkBlurMaskFilter::Create(kNormal_SkBlurStyle,
- SkBlurMask::ConvertRadiusToSigma(SkIntToScalar(3)),
- SkBlurMaskFilter::kNone_BlurFlag))->unref();
+ p.setMaskFilter(SkBlurMaskFilter::Make(kNormal_SkBlurStyle,
+ SkBlurMask::ConvertRadiusToSigma(SkIntToScalar(3)),
+ SkBlurMaskFilter::kNone_BlurFlag));
rastBuilder->addLayer(p, SkIntToScalar(3), SkIntToScalar(3));
p.setMaskFilter(nullptr);
@@ -250,9 +250,9 @@ static void apply_shader(SkPaint* paint, int index) {
#if 1
SkScalar dir[] = { SK_Scalar1, SK_Scalar1, SK_Scalar1 };
- paint->setMaskFilter(SkBlurMaskFilter::CreateEmboss(
+ paint->setMaskFilter(SkBlurMaskFilter::MakeEmboss(
SkBlurMask::ConvertRadiusToSigma(SkIntToScalar(3)), dir,
- SK_Scalar1/4, SkIntToScalar(4)))->unref();
+ SK_Scalar1/4, SkIntToScalar(4)));
paint->setColor(SK_ColorBLUE);
#endif
}
@@ -379,8 +379,6 @@ protected:
light.fDirection[2] = SK_Scalar1/3;
light.fAmbient = 0x48;
light.fSpecular = 0x80;
- SkScalar sigma = SkBlurMask::ConvertRadiusToSigma(SkIntToScalar(12)/5);
- SkMaskFilter* embossFilter = SkEmbossMaskFilter::Create(sigma, light);
auto lightingFilter = SkColorMatrixFilter::MakeLightingFilter(
0xff89bc45, 0xff112233);
@@ -420,7 +418,8 @@ protected:
// circle w/ emboss & transparent (exercises 3dshader)
canvas->translate(SkIntToScalar(50), 0);
- paint.setMaskFilter(embossFilter)->unref();
+ paint.setMaskFilter(SkEmbossMaskFilter::Make(
+ SkBlurMask::ConvertRadiusToSigma(SkIntToScalar(12)/5), light));
canvas->drawOval(rect, paint);
canvas->translate(SkIntToScalar(10), SkIntToScalar(10));
// paint.setShader(transparentShader)->unref();
« no previous file with comments | « public.bzl ('k') | samplecode/SampleAnimBlur.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698