• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #if 0  // Disabled until updated to use current API.
2 // Copyright 2019 Google LLC.
3 // Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
4 #include "tools/fiddle/examples.h"
5 // HASH=8460bf8b013f46c67e0bd96e13451aff
6 REG_FIDDLE(Canvas_saveLayerPreserveLCDTextRequests, 256, 256, false, 0) {
7 void draw(SkCanvas* canvas) {
8     SkPaint paint;
9     paint.setAntiAlias(true);
10     paint.setLCDRenderText(true);
11     paint.setTextSize(20);
12     for (auto preserve : { false, true } ) {
13         preserve ? canvas->saveLayerPreserveLCDTextRequests(nullptr, nullptr)
14                  : canvas->saveLayer(nullptr, nullptr);
15         SkPaint p;
16         p.setColor(SK_ColorWHITE);
17         // Comment out the next line to draw on a non-opaque background.
18         canvas->drawRect(SkRect::MakeLTRB(25, 40, 200, 70), p);
19         canvas->drawString("Hamburgefons", 30, 60, paint);
20         p.setColor(0xFFCCCCCC);
21         canvas->drawRect(SkRect::MakeLTRB(25, 70, 200, 100), p);
22         canvas->drawString("Hamburgefons", 30, 90, paint);
23         canvas->restore();
24         canvas->translate(0, 80);
25     }
26 }
27 }  // END FIDDLE
28 #endif  // Disabled until updated to use current API.
29