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

Side by Side Diff: tools/skiaserve/Request.cpp

Issue 2113693002: debugger: Allow for larger images. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 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 2016 Google Inc. 2 * Copyright 2016 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 "Request.h" 8 #include "Request.h"
9 9
10 #include "SkPictureRecorder.h" 10 #include "SkPictureRecorder.h"
11 #include "SkPixelSerializer.h" 11 #include "SkPixelSerializer.h"
12 #include "SkPM4fPriv.h" 12 #include "SkPM4fPriv.h"
13 #include "picture_utils.h" 13 #include "picture_utils.h"
14 14
15 using namespace sk_gpu_test; 15 using namespace sk_gpu_test;
16 16
17 static int kDefaultWidth = 1920; 17 static int kDefaultWidth = 1920;
18 static int kDefaultHeight = 1080; 18 static int kDefaultHeight = 1080;
19 static int kMaxWidth = 8192;
20 static int kMaxHeight = 8192;
19 21
20 22
21 Request::Request(SkString rootUrl) 23 Request::Request(SkString rootUrl)
22 : fUploadContext(nullptr) 24 : fUploadContext(nullptr)
23 , fUrlDataManager(rootUrl) 25 , fUrlDataManager(rootUrl)
24 , fGPUEnabled(false) 26 , fGPUEnabled(false)
25 , fColorMode(0) { 27 , fColorMode(0) {
26 // create surface 28 // create surface
27 #if SK_SUPPORT_GPU 29 #if SK_SUPPORT_GPU
28 GrContextOptions grContextOpts; 30 GrContextOptions grContextOpts;
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 return outStream.copyToData(); 121 return outStream.copyToData();
120 } 122 }
121 123
122 GrContext* Request::getContext() { 124 GrContext* Request::getContext() {
123 #if SK_SUPPORT_GPU 125 #if SK_SUPPORT_GPU
124 GrContext* result = fContextFactory->get(GrContextFactory::kNativeGL_Context Type, 126 GrContext* result = fContextFactory->get(GrContextFactory::kNativeGL_Context Type,
125 GrContextFactory::kNone_ContextOpti ons); 127 GrContextFactory::kNone_ContextOpti ons);
126 if (!result) { 128 if (!result) {
127 result = fContextFactory->get(GrContextFactory::kMESA_ContextType, 129 result = fContextFactory->get(GrContextFactory::kMESA_ContextType,
128 GrContextFactory::kNone_ContextOptions); 130 GrContextFactory::kNone_ContextOptions);
129 } 131 }
130 return result; 132 return result;
131 #else 133 #else
132 return nullptr; 134 return nullptr;
133 #endif 135 #endif
134 } 136 }
135 137
136 SkIRect Request::getBounds() { 138 SkIRect Request::getBounds() {
137 SkIRect bounds; 139 SkIRect bounds;
138 if (fPicture) { 140 if (fPicture) {
139 bounds = fPicture->cullRect().roundOut(); 141 bounds = fPicture->cullRect().roundOut();
140 if (fGPUEnabled) { 142 if (fGPUEnabled) {
141 #if SK_SUPPORT_GPU 143 #if SK_SUPPORT_GPU
142 int maxRTSize = this->getContext()->caps()->maxRenderTargetSize(); 144 int maxRTSize = this->getContext()->caps()->maxRenderTargetSize();
143 bounds = SkIRect::MakeWH(SkTMin(bounds.width(), maxRTSize), 145 bounds = SkIRect::MakeWH(SkTMin(bounds.width(), maxRTSize),
144 SkTMin(bounds.height(), maxRTSize)); 146 SkTMin(bounds.height(), maxRTSize));
145 #endif 147 #endif
146 } 148 }
147 } else { 149 } else {
148 bounds = SkIRect::MakeWH(kDefaultWidth, kDefaultHeight); 150 bounds = SkIRect::MakeWH(kDefaultWidth, kDefaultHeight);
149 } 151 }
150 152
151 // We clip to kDefaultWidth / kDefaultHeight for performance reasons 153 // We clip to kMaxWidth / kMaxHeight for performance reasons.
152 // TODO make this configurable 154 // TODO make this configurable
153 bounds = SkIRect::MakeWH(SkTMin(bounds.width(), kDefaultWidth), 155 bounds = SkIRect::MakeWH(SkTMin(bounds.width(), kMaxWidth),
154 SkTMin(bounds.height(), kDefaultHeight)); 156 SkTMin(bounds.height(), kMaxHeight));
155 return bounds; 157 return bounds;
156 } 158 }
157 159
158 namespace { 160 namespace {
159 161
160 struct ColorAndProfile { 162 struct ColorAndProfile {
161 SkColorType fColorType; 163 SkColorType fColorType;
162 bool fSRGB; 164 bool fSRGB;
163 bool fGammaCorrect; 165 bool fGammaCorrect;
164 }; 166 };
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
299 SkASSERT(bitmap); 301 SkASSERT(bitmap);
300 302
301 // Convert to format suitable for inspection 303 // Convert to format suitable for inspection
302 sk_sp<SkData> encodedBitmap = sk_tools::encode_bitmap_for_png(*bitmap); 304 sk_sp<SkData> encodedBitmap = sk_tools::encode_bitmap_for_png(*bitmap);
303 SkASSERT(encodedBitmap.get()); 305 SkASSERT(encodedBitmap.get());
304 306
305 const uint8_t* start = encodedBitmap->bytes() + ((y * bitmap->width() + x) * 4); 307 const uint8_t* start = encodedBitmap->bytes() + ((y * bitmap->width() + x) * 4);
306 SkColor result = SkColorSetARGB(start[3], start[0], start[1], start[2]); 308 SkColor result = SkColorSetARGB(start[3], start[0], start[1], start[2]);
307 return result; 309 return result;
308 } 310 }
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