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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 (0, 0, size.width(), size.height()); | 47 (0, 0, size.width(), size.height()); |
48 this->rootNode->mutateStagingProperties().setClipToBounds(false); | 48 this->rootNode->mutateStagingProperties().setClipToBounds(false); |
49 this->rootNode->setPropertyFieldsDirty(android::uirenderer::RenderNode::GENE
RIC); | 49 this->rootNode->setPropertyFieldsDirty(android::uirenderer::RenderNode::GENE
RIC); |
50 ContextFactory factory; | 50 ContextFactory factory; |
51 this->proxy.reset | 51 this->proxy.reset |
52 (new android::uirenderer::renderthread::RenderProxy(false, this->rootNod
e, &factory)); | 52 (new android::uirenderer::renderthread::RenderProxy(false, this->rootNod
e, &factory)); |
53 this->proxy->loadSystemProperties(); | 53 this->proxy->loadSystemProperties(); |
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(), lightVector, 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->canvas.reset(new android::uirenderer::DisplayListCanvas()); | 60 this->canvas.reset(new android::uirenderer::DisplayListCanvas()); |
60 this->canvas->setViewport(size.width(), size.height()); | 61 this->canvas->setViewport(size.width(), size.height()); |
61 } | 62 } |
62 | 63 |
63 SkCanvas* SkHwuiRenderer::prepareToDraw() { | 64 SkCanvas* SkHwuiRenderer::prepareToDraw() { |
64 this->canvas->prepare(); | 65 this->canvas->prepare(); |
65 this->canvas->clipRect(0, 0, this->size.width(), this->size.height(), | 66 this->canvas->clipRect(0, 0, this->size.width(), this->size.height(), |
66 SkRegion::Op::kReplace_Op); | 67 SkRegion::Op::kReplace_Op); |
67 return this->canvas->asSkCanvas(); | 68 return this->canvas->asSkCanvas(); |
68 } | 69 } |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 if (!success) { | 122 if (!success) { |
122 SkDebugf("Failed to extract pixels from HWUI buffer"); | 123 SkDebugf("Failed to extract pixels from HWUI buffer"); |
123 return false; | 124 return false; |
124 } | 125 } |
125 | 126 |
126 this->cpuConsumer->unlockBuffer(nativeBuffer); | 127 this->cpuConsumer->unlockBuffer(nativeBuffer); |
127 | 128 |
128 return true; | 129 return true; |
129 } | 130 } |
130 | 131 |
OLD | NEW |