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

Side by Side Diff: cc/layers/nine_patch_layer_impl.cc

Issue 22911024: Fix crashes when NinePatchLayer doesn't have a resource. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@shadow
Patch Set: Created 7 years, 4 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
« cc/layers/nine_patch_layer.cc ('K') | « cc/layers/nine_patch_layer.cc ('k') | 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 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "cc/layers/nine_patch_layer_impl.h" 5 #include "cc/layers/nine_patch_layer_impl.h"
6 6
7 #include "base/strings/stringprintf.h" 7 #include "base/strings/stringprintf.h"
8 #include "base/values.h" 8 #include "base/values.h"
9 #include "cc/layers/quad_sink.h" 9 #include "cc/layers/quad_sink.h"
10 #include "cc/quads/texture_draw_quad.h" 10 #include "cc/quads/texture_draw_quad.h"
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 57
58 bool NinePatchLayerImpl::WillDraw(DrawMode draw_mode, 58 bool NinePatchLayerImpl::WillDraw(DrawMode draw_mode,
59 ResourceProvider* resource_provider) { 59 ResourceProvider* resource_provider) {
60 if (!resource_id_ || draw_mode == DRAW_MODE_RESOURCELESS_SOFTWARE) 60 if (!resource_id_ || draw_mode == DRAW_MODE_RESOURCELESS_SOFTWARE)
61 return false; 61 return false;
62 return LayerImpl::WillDraw(draw_mode, resource_provider); 62 return LayerImpl::WillDraw(draw_mode, resource_provider);
63 } 63 }
64 64
65 void NinePatchLayerImpl::AppendQuads(QuadSink* quad_sink, 65 void NinePatchLayerImpl::AppendQuads(QuadSink* quad_sink,
66 AppendQuadsData* append_quads_data) { 66 AppendQuadsData* append_quads_data) {
67 DCHECK(resource_id_); 67 if (!resource_id_)
danakj 2013/08/20 02:22:32 This looks right to me, but can you move this belo
ccameron 2013/08/20 09:43:47 Ah, good catch -- done.
68 return;
68 69
69 SharedQuadState* shared_quad_state = 70 SharedQuadState* shared_quad_state =
70 quad_sink->UseSharedQuadState(CreateSharedQuadState()); 71 quad_sink->UseSharedQuadState(CreateSharedQuadState());
71 AppendDebugBorderQuad(quad_sink, shared_quad_state, append_quads_data); 72 AppendDebugBorderQuad(quad_sink, shared_quad_state, append_quads_data);
72 73
73 static const bool flipped = false; 74 static const bool flipped = false;
74 static const bool premultiplied_alpha = true; 75 static const bool premultiplied_alpha = true;
75 76
76 DCHECK(!bounds().IsEmpty()); 77 DCHECK(!bounds().IsEmpty());
77 78
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
296 297
297 list = new base::ListValue; 298 list = new base::ListValue;
298 list->AppendInteger(image_bounds_.width()); 299 list->AppendInteger(image_bounds_.width());
299 list->AppendInteger(image_bounds_.height()); 300 list->AppendInteger(image_bounds_.height());
300 result->Set("ImageBounds", list); 301 result->Set("ImageBounds", list);
301 302
302 return result; 303 return result;
303 } 304 }
304 305
305 } // namespace cc 306 } // namespace cc
OLDNEW
« cc/layers/nine_patch_layer.cc ('K') | « cc/layers/nine_patch_layer.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698