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

Side by Side Diff: src/gpu/GrGpu.cpp

Issue 1310843007: Various minor cross-platform changes (Closed) Base URL: https://chromium.googlesource.com/skia@master
Patch Set: Created 5 years, 3 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
OLDNEW
1 1
2 /* 2 /*
3 * Copyright 2010 Google Inc. 3 * Copyright 2010 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 8
9 9
10 #include "GrGpu.h" 10 #include "GrGpu.h"
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
265 !this->caps()->isConfigRenderable(tempDrawInfo->fTempSurfaceDesc.fConfig , false)) { 265 !this->caps()->isConfigRenderable(tempDrawInfo->fTempSurfaceDesc.fConfig , false)) {
266 // If we don't have a fallback to a straight read then fail. 266 // If we don't have a fallback to a straight read then fail.
267 if (kRequireDraw_DrawPreference == *drawPreference) { 267 if (kRequireDraw_DrawPreference == *drawPreference) {
268 return false; 268 return false;
269 } 269 }
270 *drawPreference = kNoDraw_DrawPreference; 270 *drawPreference = kNoDraw_DrawPreference;
271 } 271 }
272 272
273 return true; 273 return true;
274 } 274 }
275
275 bool GrGpu::getWritePixelsInfo(GrSurface* dstSurface, int width, int height, siz e_t rowBytes, 276 bool GrGpu::getWritePixelsInfo(GrSurface* dstSurface, int width, int height, siz e_t rowBytes,
276 GrPixelConfig srcConfig, DrawPreference* drawPref erence, 277 GrPixelConfig srcConfig, DrawPreference* drawPref erence,
277 WritePixelTempDrawInfo* tempDrawInfo) { 278 WritePixelTempDrawInfo* tempDrawInfo) {
278 SkASSERT(drawPreference); 279 SkASSERT(drawPreference);
279 SkASSERT(tempDrawInfo); 280 SkASSERT(tempDrawInfo);
280 SkASSERT(kGpuPrefersDraw_DrawPreference != *drawPreference); 281 SkASSERT(kGpuPrefersDraw_DrawPreference != *drawPreference);
281 282
283 if (GrPixelConfigIsCompressed(dstSurface->desc().fConfig) &&
284 dstSurface->desc().fConfig != srcConfig) {
285 return false;
286 }
287
282 if (this->caps()->useDrawInsteadOfPartialRenderTargetWrite() && 288 if (this->caps()->useDrawInsteadOfPartialRenderTargetWrite() &&
283 SkToBool(dstSurface->asRenderTarget()) && 289 SkToBool(dstSurface->asRenderTarget()) &&
284 (width < dstSurface->width() || height < dstSurface->height())) { 290 (width < dstSurface->width() || height < dstSurface->height())) {
285 ElevateDrawPreference(drawPreference, kRequireDraw_DrawPreference); 291 ElevateDrawPreference(drawPreference, kRequireDraw_DrawPreference);
286 } 292 }
287 293
288 if (!this->onGetWritePixelsInfo(dstSurface, width, height, rowBytes, srcConf ig, drawPreference, 294 if (!this->onGetWritePixelsInfo(dstSurface, width, height, rowBytes, srcConf ig, drawPreference,
289 tempDrawInfo)) { 295 tempDrawInfo)) {
290 return false; 296 return false;
291 } 297 }
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
325 return this->onReadPixels(surface, 331 return this->onReadPixels(surface,
326 left, top, width, height, 332 left, top, width, height,
327 config, buffer, 333 config, buffer,
328 rowBytes); 334 rowBytes);
329 } 335 }
330 336
331 bool GrGpu::writePixels(GrSurface* surface, 337 bool GrGpu::writePixels(GrSurface* surface,
332 int left, int top, int width, int height, 338 int left, int top, int width, int height,
333 GrPixelConfig config, const void* buffer, 339 GrPixelConfig config, const void* buffer,
334 size_t rowBytes) { 340 size_t rowBytes) {
341 if (!buffer) {
342 return false;
343 }
344
335 this->handleDirtyContext(); 345 this->handleDirtyContext();
336 if (this->onWritePixels(surface, left, top, width, height, config, buffer, r owBytes)) { 346 if (this->onWritePixels(surface, left, top, width, height, config, buffer, r owBytes)) {
337 fStats.incTextureUploads(); 347 fStats.incTextureUploads();
338 return true; 348 return true;
339 } 349 }
340 return false; 350 return false;
341 } 351 }
342 352
343 void GrGpu::resolveRenderTarget(GrRenderTarget* target) { 353 void GrGpu::resolveRenderTarget(GrRenderTarget* target) {
344 SkASSERT(target); 354 SkASSERT(target);
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
394 if (GrXferBarrierType barrierType = args.fPipeline->xferBarrierType(*this->c aps())) { 404 if (GrXferBarrierType barrierType = args.fPipeline->xferBarrierType(*this->c aps())) {
395 this->xferBarrier(args.fPipeline->getRenderTarget(), barrierType); 405 this->xferBarrier(args.fPipeline->getRenderTarget(), barrierType);
396 } 406 }
397 407
398 GrVertices::Iterator iter; 408 GrVertices::Iterator iter;
399 const GrNonInstancedVertices* verts = iter.init(vertices); 409 const GrNonInstancedVertices* verts = iter.init(vertices);
400 do { 410 do {
401 this->onDraw(args, *verts); 411 this->onDraw(args, *verts);
402 } while ((verts = iter.next())); 412 } while ((verts = iter.next()));
403 } 413 }
OLDNEW
« gyp/tests.gypi ('K') | « gyp/tests.gypi ('k') | src/gpu/gl/GrGLGpu.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698