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

Side by Side Diff: src/utils/android/SkHwuiRenderer.cpp

Issue 1235823003: Cleanup skia test harness due to changes to DisplayListCanvas (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 5 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 | « no previous file | 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
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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
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(), 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()); 60 this->canvas.reset(new android::uirenderer::DisplayListCanvas(size.width(), size.height()));
61 this->canvas->setViewport(size.width(), size.height());
62 } 61 }
63 62
64 SkCanvas* SkHwuiRenderer::prepareToDraw() { 63 SkCanvas* SkHwuiRenderer::prepareToDraw() {
65 this->canvas->prepare(); 64 this->canvas->reset(size.width(), size.height());
66 this->canvas->clipRect(0, 0, this->size.width(), this->size.height(), 65 this->canvas->clipRect(0, 0, this->size.width(), this->size.height(),
67 SkRegion::Op::kReplace_Op); 66 SkRegion::Op::kReplace_Op);
68 return this->canvas->asSkCanvas(); 67 return this->canvas->asSkCanvas();
69 } 68 }
70 69
71 void SkHwuiRenderer::finishDrawing() { 70 void SkHwuiRenderer::finishDrawing() {
72 this->canvas->finish();
73 this->rootNode->setStagingDisplayList(this->canvas->finishRecording()); 71 this->rootNode->setStagingDisplayList(this->canvas->finishRecording());
74 this->proxy->syncAndDrawFrame(); 72 this->proxy->syncAndDrawFrame();
75 // Surprisingly, calling this->proxy->fence() here appears to make no differ ence to 73 // Surprisingly, calling this->proxy->fence() here appears to make no differ ence to
76 // the timings we record. 74 // the timings we record.
77 } 75 }
78 76
79 bool SkHwuiRenderer::capturePixels(SkBitmap* bmp) { 77 bool SkHwuiRenderer::capturePixels(SkBitmap* bmp) {
80 SkImageInfo destinationConfig = 78 SkImageInfo destinationConfig =
81 SkImageInfo::Make(this->size.width(), this->size.height(), 79 SkImageInfo::Make(this->size.width(), this->size.height(),
82 kRGBA_8888_SkColorType, kPremul_SkAlphaType); 80 kRGBA_8888_SkColorType, kPremul_SkAlphaType);
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 if (!success) { 120 if (!success) {
123 SkDebugf("Failed to extract pixels from HWUI buffer"); 121 SkDebugf("Failed to extract pixels from HWUI buffer");
124 return false; 122 return false;
125 } 123 }
126 124
127 this->cpuConsumer->unlockBuffer(nativeBuffer); 125 this->cpuConsumer->unlockBuffer(nativeBuffer);
128 126
129 return true; 127 return true;
130 } 128 }
131 129
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698