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

Side by Side Diff: samplecode/SampleTextureDomain.cpp

Issue 22978012: Split SkDevice into SkBaseDevice and SkBitmapDevice (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Updating to ToT (10994) Created 7 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « samplecode/SampleCircle.cpp ('k') | src/core/SkBBoxHierarchyRecord.h » ('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 "SkCanvas.h" 9 #include "SkCanvas.h"
10 #include "SkDevice.h" 10 #include "SkDevice.h"
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 // Test that bitmap draws from malloc-backed bitmaps respect 54 // Test that bitmap draws from malloc-backed bitmaps respect
55 // the constrained texture domain. 55 // the constrained texture domain.
56 srcRect.setXYWH(1, 1, 3, 3); 56 srcRect.setXYWH(1, 1, 3, 3);
57 dstRect.setXYWH(5.0f, 5.0f, 305.0f, 305.0f); 57 dstRect.setXYWH(5.0f, 5.0f, 305.0f, 305.0f);
58 canvas->drawBitmapRect(fBM, &srcRect, dstRect, &paint); 58 canvas->drawBitmapRect(fBM, &srcRect, dstRect, &paint);
59 59
60 // Test that bitmap draws across separate devices also respect 60 // Test that bitmap draws across separate devices also respect
61 // the constrainted texture domain. 61 // the constrainted texture domain.
62 // Note: GPU-backed bitmaps follow a different rendering path 62 // Note: GPU-backed bitmaps follow a different rendering path
63 // when copying from one GPU device to another. 63 // when copying from one GPU device to another.
64 SkAutoTUnref<SkDevice> secondDevice(canvas->createCompatibleDevice( 64 SkAutoTUnref<SkBaseDevice> secondDevice(canvas->createCompatibleDevice(
65 SkBitmap::kARGB_8888_Config, 5, 5, true)); 65 SkBitmap::kARGB_8888_Config, 5, 5, true));
66 SkCanvas secondCanvas(secondDevice.get()); 66 SkCanvas secondCanvas(secondDevice.get());
67 67
68 srcRect.setXYWH(1, 1, 3, 3); 68 srcRect.setXYWH(1, 1, 3, 3);
69 dstRect.setXYWH(1.0f, 1.0f, 3.0f, 3.0f); 69 dstRect.setXYWH(1.0f, 1.0f, 3.0f, 3.0f);
70 secondCanvas.drawBitmapRect(fBM, &srcRect, dstRect, &paint); 70 secondCanvas.drawBitmapRect(fBM, &srcRect, dstRect, &paint);
71 71
72 SkBitmap deviceBitmap = secondDevice->accessBitmap(false); 72 SkBitmap deviceBitmap = secondDevice->accessBitmap(false);
73 73
74 srcRect.setXYWH(1, 1, 3, 3); 74 srcRect.setXYWH(1, 1, 3, 3);
(...skipping 29 matching lines...) Expand all
104 canvas->drawBitmapRect(fBM, NULL, dstRect, &paint); 104 canvas->drawBitmapRect(fBM, NULL, dstRect, &paint);
105 } 105 }
106 private: 106 private:
107 typedef SkView INHERITED; 107 typedef SkView INHERITED;
108 }; 108 };
109 109
110 ////////////////////////////////////////////////////////////////////////////// 110 //////////////////////////////////////////////////////////////////////////////
111 111
112 static SkView* MyFactory() { return new TextureDomainView; } 112 static SkView* MyFactory() { return new TextureDomainView; }
113 static SkViewRegister reg(MyFactory); 113 static SkViewRegister reg(MyFactory);
OLDNEW
« no previous file with comments | « samplecode/SampleCircle.cpp ('k') | src/core/SkBBoxHierarchyRecord.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698