OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #include "SkHwuiRenderer.h" | 8 #include "SkHwuiRenderer.h" |
9 | 9 |
10 #include "AnimationContext.h" | 10 #include "AnimationContext.h" |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 this->proxy->initialize(this->androidSurface.get()); | 54 this->proxy->initialize(this->androidSurface.get()); |
55 float lightX = size.width() / 2.0f; | 55 float lightX = size.width() / 2.0f; |
56 android::uirenderer::Vector3 lightVector { lightX, -200.0f, 800.0f }; | 56 android::uirenderer::Vector3 lightVector { lightX, -200.0f, 800.0f }; |
57 this->proxy->setup(size.width(), size.height(), 800.0f, | 57 this->proxy->setup(size.width(), size.height(), 800.0f, |
58 255 * 0.075f, 255 * 0.15f); | 58 255 * 0.075f, 255 * 0.15f); |
59 this->proxy->setLightCenter(lightVector); | 59 this->proxy->setLightCenter(lightVector); |
60 this->canvas.reset(new android::uirenderer::DisplayListCanvas(size.width(),
size.height())); | 60 this->canvas.reset(new android::uirenderer::DisplayListCanvas(size.width(),
size.height())); |
61 } | 61 } |
62 | 62 |
63 SkCanvas* SkHwuiRenderer::prepareToDraw() { | 63 SkCanvas* SkHwuiRenderer::prepareToDraw() { |
64 this->canvas->reset(size.width(), size.height()); | |
65 this->canvas->clipRect(0, 0, this->size.width(), this->size.height(), | 64 this->canvas->clipRect(0, 0, this->size.width(), this->size.height(), |
66 SkRegion::Op::kReplace_Op); | 65 SkRegion::Op::kReplace_Op); |
67 return this->canvas->asSkCanvas(); | 66 return this->canvas->asSkCanvas(); |
68 } | 67 } |
69 | 68 |
70 void SkHwuiRenderer::finishDrawing() { | 69 void SkHwuiRenderer::finishDrawing() { |
71 this->rootNode->setStagingDisplayList(this->canvas->finishRecording()); | 70 this->rootNode->setStagingDisplayList(this->canvas->finishRecording()); |
72 this->proxy->syncAndDrawFrame(); | 71 this->proxy->syncAndDrawFrame(); |
73 // Surprisingly, calling this->proxy->fence() here appears to make no differ
ence to | 72 // Surprisingly, calling this->proxy->fence() here appears to make no differ
ence to |
74 // the timings we record. | 73 // the timings we record. |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 if (!success) { | 119 if (!success) { |
121 SkDebugf("Failed to extract pixels from HWUI buffer"); | 120 SkDebugf("Failed to extract pixels from HWUI buffer"); |
122 return false; | 121 return false; |
123 } | 122 } |
124 | 123 |
125 this->cpuConsumer->unlockBuffer(nativeBuffer); | 124 this->cpuConsumer->unlockBuffer(nativeBuffer); |
126 | 125 |
127 return true; | 126 return true; |
128 } | 127 } |
129 | 128 |
OLD | NEW |