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

Side by Side Diff: samplecode/SampleAll.cpp

Issue 173633003: Factory methods for heap-allocated SkMaskFilter objects. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Add SkTableMaskFilter::Create(table) and remove deprecated SkEmbossMaskFilter constructor. Created 6 years, 10 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/effects/SkTableMaskFilter.h ('k') | samplecode/SampleEmboss.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 /* 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 "SampleCode.h" 8 #include "SampleCode.h"
9 #include "SkBlurMask.h" 9 #include "SkBlurMask.h"
10 #include "SkCanvas.h" 10 #include "SkCanvas.h"
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after
381 radialMode, radialMapper); 381 radialMode, radialMapper);
382 382
383 SkTransparentShader* transparentShader = new SkTransparentShader(); 383 SkTransparentShader* transparentShader = new SkTransparentShader();
384 SkEmbossMaskFilter::Light light; 384 SkEmbossMaskFilter::Light light;
385 light.fDirection[0] = SK_Scalar1/2; 385 light.fDirection[0] = SK_Scalar1/2;
386 light.fDirection[1] = SK_Scalar1/2; 386 light.fDirection[1] = SK_Scalar1/2;
387 light.fDirection[2] = SK_Scalar1/3; 387 light.fDirection[2] = SK_Scalar1/3;
388 light.fAmbient = 0x48; 388 light.fAmbient = 0x48;
389 light.fSpecular = 0x80; 389 light.fSpecular = 0x80;
390 SkScalar sigma = SkBlurMask::ConvertRadiusToSigma(SkIntToScalar(12)/5); 390 SkScalar sigma = SkBlurMask::ConvertRadiusToSigma(SkIntToScalar(12)/5);
391 SkEmbossMaskFilter* embossFilter = new SkEmbossMaskFilter(sigma, light); 391 SkEmbossMaskFilter* embossFilter = SkEmbossMaskFilter::Create(sigma, lig ht);
392 392
393 SkXfermode* xfermode = SkXfermode::Create(SkXfermode::kXor_Mode); 393 SkXfermode* xfermode = SkXfermode::Create(SkXfermode::kXor_Mode);
394 SkColorFilter* lightingFilter = SkColorFilter::CreateLightingFilter( 394 SkColorFilter* lightingFilter = SkColorFilter::CreateLightingFilter(
395 0xff89bc45, 0xff112233); 395 0xff89bc45, 0xff112233);
396 396
397 canvas->save(); 397 canvas->save();
398 canvas->translate(SkIntToScalar(0), SkIntToScalar(5)); 398 canvas->translate(SkIntToScalar(0), SkIntToScalar(5));
399 paint.setAntiAlias(true); 399 paint.setAntiAlias(true);
400 paint.setFilterLevel(SkPaint::kLow_FilterLevel); 400 paint.setFilterLevel(SkPaint::kLow_FilterLevel);
401 // !!! draw through a clip 401 // !!! draw through a clip
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
642 private: 642 private:
643 SkPoint fClickPt; 643 SkPoint fClickPt;
644 SkBitmap fBug, fTb, fTx; 644 SkBitmap fBug, fTb, fTx;
645 typedef SampleView INHERITED; 645 typedef SampleView INHERITED;
646 }; 646 };
647 647
648 ////////////////////////////////////////////////////////////////////////////// 648 //////////////////////////////////////////////////////////////////////////////
649 649
650 static SkView* MyFactory() { return new DemoView; } 650 static SkView* MyFactory() { return new DemoView; }
651 static SkViewRegister reg(MyFactory); 651 static SkViewRegister reg(MyFactory);
OLDNEW
« no previous file with comments | « include/effects/SkTableMaskFilter.h ('k') | samplecode/SampleEmboss.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698