OLD | NEW |
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 Loading... |
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 Loading... |
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); |
OLD | NEW |