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

Side by Side Diff: tests/PipeTest.cpp

Issue 1568883003: remove SkGPipe (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 11 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 | « src/pipe/utils/SamplePipeControllers.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 /*
2 * Copyright 2012 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8 #include "SamplePipeControllers.h"
9 #include "SkBitmap.h"
10 #include "SkCanvas.h"
11 #include "SkGPipe.h"
12 #include "SkPaint.h"
13 #include "SkShader.h"
14 #include "Test.h"
15
16 // Ensures that the pipe gracefully handles drawing an invalid bitmap.
17 static void testDrawingBadBitmap(SkCanvas* pipeCanvas) {
18 SkBitmap badBitmap;
19 badBitmap.setInfo(SkImageInfo::MakeUnknown(5, 5));
20 pipeCanvas->drawBitmap(badBitmap, 0, 0);
21 }
22
23 // Ensure that pipe gracefully handles attempting to draw after endRecording is called on the
24 // SkGPipeWriter.
25 static void testDrawingAfterEndRecording(SkCanvas* canvas) {
26 PipeController pc(canvas);
27 SkGPipeWriter writer;
28 SkCanvas* pipeCanvas = writer.startRecording(&pc, SkGPipeWriter::kCrossProce ss_Flag);
29 writer.endRecording();
30
31 SkBitmap bm;
32 bm.allocN32Pixels(2, 2);
33 bm.eraseColor(SK_ColorTRANSPARENT);
34
35 SkShader* shader = SkShader::CreateBitmapShader(bm, SkShader::kClamp_TileMod e,
36 SkShader::kClamp_TileMode);
37 SkPaint paint;
38 paint.setShader(shader)->unref();
39 pipeCanvas->drawPaint(paint);
40
41 pipeCanvas->drawBitmap(bm, 0, 0);
42 }
43
44 DEF_TEST(Pipe, reporter) {
45 SkBitmap bitmap;
46 bitmap.setInfo(SkImageInfo::MakeN32Premul(64, 64));
47 SkCanvas canvas(bitmap);
48
49 PipeController pipeController(&canvas);
50 SkGPipeWriter writer;
51 SkCanvas* pipeCanvas = writer.startRecording(&pipeController);
52 testDrawingBadBitmap(pipeCanvas);
53 writer.endRecording();
54
55 testDrawingAfterEndRecording(&canvas);
56 }
OLDNEW
« no previous file with comments | « src/pipe/utils/SamplePipeControllers.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698