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

Side by Side Diff: third_party/WebKit/Source/platform/graphics/GeneratedImage.cpp

Issue 1841833002: Deal gracefully with null {GraphicsContext,SkPictureBuilder}.endRecording() results. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Don't end recording twice in DrawingRecorder. Created 4 years, 8 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 * Copyright (C) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 30 matching lines...) Expand all
41 const FloatPoint& phase, SkXfermode::Mode compositeOp, const FloatRect& dest Rect, 41 const FloatPoint& phase, SkXfermode::Mode compositeOp, const FloatRect& dest Rect,
42 const FloatSize& repeatSpacing) 42 const FloatSize& repeatSpacing)
43 { 43 {
44 FloatRect tileRect = srcRect; 44 FloatRect tileRect = srcRect;
45 tileRect.expand(FloatSize(repeatSpacing)); 45 tileRect.expand(FloatSize(repeatSpacing));
46 46
47 SkPictureBuilder builder(tileRect, nullptr, &destContext); 47 SkPictureBuilder builder(tileRect, nullptr, &destContext);
48 builder.context().beginRecording(tileRect); 48 builder.context().beginRecording(tileRect);
49 drawTile(builder.context(), srcRect); 49 drawTile(builder.context(), srcRect);
50 RefPtr<SkPicture> tilePicture = builder.endRecording(); 50 RefPtr<SkPicture> tilePicture = builder.endRecording();
51 if (!tilePicture)
52 return;
51 53
52 AffineTransform patternTransform; 54 AffineTransform patternTransform;
53 patternTransform.translate(phase.x(), phase.y()); 55 patternTransform.translate(phase.x(), phase.y());
54 patternTransform.scale(scale.width(), scale.height()); 56 patternTransform.scale(scale.width(), scale.height());
55 patternTransform.translate(tileRect.x(), tileRect.y()); 57 patternTransform.translate(tileRect.x(), tileRect.y());
56 58
57 RefPtr<Pattern> picturePattern = Pattern::createPicturePattern(tilePicture.r elease()); 59 RefPtr<Pattern> picturePattern = Pattern::createPicturePattern(tilePicture.r elease());
58 picturePattern->setPatternSpaceTransform(patternTransform); 60 picturePattern->setPatternSpaceTransform(patternTransform);
59 61
60 SkPaint fillPaint = destContext.fillPaint(); 62 SkPaint fillPaint = destContext.fillPaint();
61 picturePattern->applyToPaint(fillPaint); 63 picturePattern->applyToPaint(fillPaint);
62 fillPaint.setColor(SK_ColorBLACK); 64 fillPaint.setColor(SK_ColorBLACK);
63 fillPaint.setXfermodeMode(compositeOp); 65 fillPaint.setXfermodeMode(compositeOp);
64 66
65 destContext.drawRect(destRect, fillPaint); 67 destContext.drawRect(destRect, fillPaint);
66 } 68 }
67 69
68 PassRefPtr<SkImage> GeneratedImage::imageForCurrentFrame() 70 PassRefPtr<SkImage> GeneratedImage::imageForCurrentFrame()
69 { 71 {
70 return nullptr; 72 return nullptr;
71 } 73 }
72 74
73 } // namespace blink 75 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698