OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2008 The Android Open Source Project | 2 * Copyright 2008 The Android Open Source Project |
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 "SkBitmapDevice.h" | 8 #include "SkBitmapDevice.h" |
9 #include "SkCanvas.h" | 9 #include "SkCanvas.h" |
10 #include "SkCanvasPriv.h" | 10 #include "SkCanvasPriv.h" |
(...skipping 3213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3224 | 3224 |
3225 sk_sp<SkImage> povDepthMap; | 3225 sk_sp<SkImage> povDepthMap; |
3226 sk_sp<SkImage> diffuseMap; | 3226 sk_sp<SkImage> diffuseMap; |
3227 | 3227 |
3228 // TODO: pass the depth to the shader in vertices, or uniforms | 3228 // TODO: pass the depth to the shader in vertices, or uniforms |
3229 // so we don't have to render depth and color separately | 3229 // so we don't have to render depth and color separately |
3230 for (int i = 0; i < fLights->numLights(); ++i) { | 3230 for (int i = 0; i < fLights->numLights(); ++i) { |
3231 // skip over ambient lights; they don't cast shadows | 3231 // skip over ambient lights; they don't cast shadows |
3232 // lights that have shadow maps do not need updating (because lights are
immutable) | 3232 // lights that have shadow maps do not need updating (because lights are
immutable) |
3233 | 3233 |
3234 if (SkLights::Light::kAmbient_LightType == fLights->light(i).type() || | 3234 if (fLights->light(i).getShadowMap() != nullptr) { |
3235 fLights->light(i).getShadowMap() != nullptr) { | |
3236 continue; | 3235 continue; |
3237 } | 3236 } |
3238 | 3237 |
3239 // TODO: compute the correct size of the depth map from the light proper
ties | 3238 // TODO: compute the correct size of the depth map from the light proper
ties |
3240 // TODO: maybe add a kDepth_8_SkColorType | 3239 // TODO: maybe add a kDepth_8_SkColorType |
3241 // TODO: find actual max depth of picture | 3240 // TODO: find actual max depth of picture |
3242 SkISize shMapSize = SkShadowPaintFilterCanvas::ComputeDepthMapSize( | 3241 SkISize shMapSize = SkShadowPaintFilterCanvas::ComputeDepthMapSize( |
3243 fLights->light(i), 255, | 3242 fLights->light(i), 255, |
3244 picture->cullRect().width(), | 3243 picture->cullRect().width(), |
3245 picture->cullRect().height()); | 3244 picture->cullRect().height()); |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3447 | 3446 |
3448 SkAutoCanvasMatrixPaint::~SkAutoCanvasMatrixPaint() { | 3447 SkAutoCanvasMatrixPaint::~SkAutoCanvasMatrixPaint() { |
3449 fCanvas->restoreToCount(fSaveCount); | 3448 fCanvas->restoreToCount(fSaveCount); |
3450 } | 3449 } |
3451 | 3450 |
3452 #ifdef SK_SUPPORT_LEGACY_NEW_SURFACE_API | 3451 #ifdef SK_SUPPORT_LEGACY_NEW_SURFACE_API |
3453 SkSurface* SkCanvas::newSurface(const SkImageInfo& info, const SkSurfaceProps* p
rops) { | 3452 SkSurface* SkCanvas::newSurface(const SkImageInfo& info, const SkSurfaceProps* p
rops) { |
3454 return this->makeSurface(info, props).release(); | 3453 return this->makeSurface(info, props).release(); |
3455 } | 3454 } |
3456 #endif | 3455 #endif |
OLD | NEW |