|
1 /* |
|
2 * Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: Implementation of CVisualFrameImpl |
|
15 * |
|
16 */ |
|
17 |
|
18 #include "IclExtJpegApi.h" |
|
19 #include "IclExtJpegApiFrameImpl.h" |
|
20 |
|
21 // --------------------------------------------------------- |
|
22 // TFrameFormatExt::Constructor |
|
23 // --------------------------------------------------------- |
|
24 // |
|
25 void TFrameFormatExt::Constructor() |
|
26 { |
|
27 switch ( iFormatCode ) |
|
28 { |
|
29 case CVisualFrame::EFormatMonochrome: |
|
30 { |
|
31 iColourSpace = KUidColourSpaceYCbCr; |
|
32 iSampling = KUidSamplingMonochrome; |
|
33 break; |
|
34 } |
|
35 case CVisualFrame::EFormat16bitRGB444: |
|
36 case CVisualFrame::EFormat16BitRGB565: |
|
37 case CVisualFrame::EFormat32BitRGB888: |
|
38 case CVisualFrame::EFormatFbsBitmapColor4K: |
|
39 case CVisualFrame::EFormatFbsBitmapColor64K: |
|
40 case CVisualFrame::EFormatFbsBitmapColor16M: |
|
41 { |
|
42 iColourSpace = KUidColourSpaceRGB; |
|
43 iSampling = KUidSamplingColor444; |
|
44 break; |
|
45 } |
|
46 case CVisualFrame::EFormatYUV420SemiPlanar: |
|
47 case CVisualFrame::EFormatYUV420Interleaved: |
|
48 case CVisualFrame::EFormatYUV420Planar: |
|
49 { |
|
50 iColourSpace = KUidColourSpaceYCbCr; |
|
51 iSampling = KUidSamplingColor420; |
|
52 break; |
|
53 } |
|
54 case CVisualFrame::EFormatYUV422: |
|
55 case CVisualFrame::EFormatYUV422Reversed: |
|
56 case CVisualFrame::EFormatExtYUV422Interleaved: |
|
57 case CVisualFrame::EFormatExtYUV422Planar: |
|
58 { |
|
59 iColourSpace = KUidColourSpaceYCbCr; |
|
60 iSampling = KUidSamplingColor422; |
|
61 break; |
|
62 } |
|
63 case CVisualFrame::EFormatExtYUV444Planar: |
|
64 case CVisualFrame::EFormatYUV444: |
|
65 { |
|
66 iColourSpace = KUidColourSpaceYCbCr; |
|
67 iSampling = KUidSamplingColor444; |
|
68 break; |
|
69 } |
|
70 case CVisualFrame::EFormatJpeg: |
|
71 case CVisualFrame::EFormatExif: |
|
72 case CVisualFrame::EFormatUserDefined: |
|
73 case CVisualFrame::EFormatExtDctCoeff: |
|
74 { |
|
75 iColourSpace = KNullUid; |
|
76 iSampling = KNullUid; |
|
77 break; |
|
78 } |
|
79 default: |
|
80 { |
|
81 iFormatCode = KErrNotFound; |
|
82 iColourSpace = KNullUid; |
|
83 iSampling = KNullUid; |
|
84 } |
|
85 } |
|
86 } |
|
87 |
|
88 // ---------------------------------------------------------- |
|
89 // TFrameFormatExt::ColourSpace |
|
90 // ---------------------------------------------------------- |
|
91 // |
|
92 TUid TFrameFormatExt::ColourSpace() const |
|
93 { |
|
94 return iColourSpace; |
|
95 } |
|
96 |
|
97 // ---------------------------------------------------------- |
|
98 // TFrameFormatExt::Sampling |
|
99 // ---------------------------------------------------------- |
|
100 // |
|
101 TUid TFrameFormatExt::Sampling() const |
|
102 { |
|
103 return iSampling; |
|
104 } |
|
105 |
|
106 // ---------------------------------------------------------- |
|
107 // TFrameFormatExt::FormatCode |
|
108 // ---------------------------------------------------------- |
|
109 // |
|
110 TInt TFrameFormatExt::FormatCode() const |
|
111 { |
|
112 return iFormatCode; |
|
113 } |
|
114 |
|
115 // ---------------------------------------------------------- |
|
116 // TFrameFormatExt::ColourSpace |
|
117 // ---------------------------------------------------------- |
|
118 // |
|
119 void TFrameFormatExt::SetColourSpace( TUid aColourSpace ) |
|
120 { |
|
121 iColourSpace = aColourSpace; |
|
122 } |
|
123 |
|
124 |
|
125 |
|
126 /*****************************************************/ |
|
127 /* Visual Frame Data Structure in Extended ICL API */ |
|
128 /*****************************************************/ |
|
129 |
|
130 |
|
131 // ---------------------------------------------------------- |
|
132 // TFrameFormatBase* GetFrameFormatL |
|
133 // ---------------------------------------------------------- |
|
134 // |
|
135 TFrameFormatBase* GetFrameFormatL( TInt aFrameFormatCode ) |
|
136 { |
|
137 TUid formatUid = KNullUid; |
|
138 switch ( aFrameFormatCode ) |
|
139 { |
|
140 case CVisualFrame::EFormatMonochrome: |
|
141 { |
|
142 formatUid = KUidFormatYUVMonochrome; |
|
143 break; |
|
144 } |
|
145 case CVisualFrame::EFormat16bitRGB444: |
|
146 { |
|
147 formatUid = KUidFormat16bitRGB444Interleaved; |
|
148 break; |
|
149 } |
|
150 case CVisualFrame::EFormat16BitRGB565: |
|
151 { |
|
152 formatUid = KUidFormat16BitRGB565Interleaved; |
|
153 break; |
|
154 } |
|
155 case CVisualFrame::EFormat32BitRGB888: |
|
156 { |
|
157 formatUid = KUidFormat32BitRGB888Interleaved; |
|
158 break; |
|
159 } |
|
160 case CVisualFrame::EFormatYUV420Interleaved: |
|
161 { |
|
162 formatUid = KUidFormatYUV420Interleaved; |
|
163 break; |
|
164 } |
|
165 case CVisualFrame::EFormatYUV420Planar: |
|
166 { |
|
167 formatUid = KUidFormatYUV420Planar; |
|
168 break; |
|
169 } |
|
170 case CVisualFrame::EFormatYUV422: |
|
171 { |
|
172 formatUid = KUidFormatYUV422Interleaved; |
|
173 break; |
|
174 } |
|
175 case CVisualFrame::EFormatYUV422Reversed: |
|
176 { |
|
177 formatUid = KUidFormatYUV422InterleavedReversed; |
|
178 break; |
|
179 } |
|
180 case CVisualFrame::EFormatYUV444: |
|
181 { |
|
182 formatUid = KUidFormatYUV444Interleaved; |
|
183 break; |
|
184 } |
|
185 case CVisualFrame::EFormatYUV420SemiPlanar: |
|
186 { |
|
187 formatUid = KUidFormatYUV420SemiPlanar; |
|
188 break; |
|
189 } |
|
190 case CVisualFrame::EFormatExtYUV422Interleaved: |
|
191 { |
|
192 formatUid = KUidFormatYYUV422Interleaved; |
|
193 break; |
|
194 } |
|
195 case CVisualFrame::EFormatExtYUV422Planar: |
|
196 { |
|
197 formatUid = KUidFormatYUV422Planar; |
|
198 break; |
|
199 } |
|
200 case CVisualFrame::EFormatExtYUV444Planar: |
|
201 { |
|
202 formatUid = KUidFormatYUV444Planar; |
|
203 break; |
|
204 } |
|
205 case CVisualFrame::EFormatJpeg: |
|
206 case CVisualFrame::EFormatExif: |
|
207 case CVisualFrame::EFormatFbsBitmapColor4K: |
|
208 case CVisualFrame::EFormatFbsBitmapColor64K: |
|
209 case CVisualFrame::EFormatFbsBitmapColor16M: |
|
210 case CVisualFrame::EFormatUserDefined: |
|
211 case CVisualFrame::EFormatExtDctCoeff: |
|
212 { |
|
213 break; |
|
214 } |
|
215 default: |
|
216 { |
|
217 User::Leave( KErrNotSupported ); |
|
218 } |
|
219 } |
|
220 TFrameFormatBase* frameFormatBase = NULL; |
|
221 if ( formatUid == KNullUid ) |
|
222 { |
|
223 frameFormatBase = new ( ELeave ) TFrameFormatExt( aFrameFormatCode ); |
|
224 } |
|
225 else |
|
226 { |
|
227 frameFormatBase = new ( ELeave ) TFrameFormat( formatUid ); |
|
228 } |
|
229 return frameFormatBase; |
|
230 } |
|
231 |
|
232 // ---------------------------------------------------------- |
|
233 // GetFrameFormat |
|
234 // ---------------------------------------------------------- |
|
235 // |
|
236 TInt GetFrameFormat( const TFrameFormatBase& aFrameFormat ) |
|
237 { |
|
238 TInt frameFormatCode = KErrNotFound; |
|
239 if ( aFrameFormat.Type() == KUidIclImageFrameFormat ) |
|
240 { |
|
241 const TFrameFormat& frameFormat = reinterpret_cast<const TFrameFormat&>( aFrameFormat ); |
|
242 switch ( frameFormat.FormatCode().iUid ) |
|
243 { |
|
244 case KFormatYUVMonochromeUidValue: |
|
245 { |
|
246 frameFormatCode = CVisualFrame::EFormatMonochrome; |
|
247 break; |
|
248 } |
|
249 case KFormat16bitRGB444InterleavedUidValue: |
|
250 { |
|
251 frameFormatCode = CVisualFrame::EFormat16bitRGB444; |
|
252 break; |
|
253 } |
|
254 case KFormat16BitRGB565InterleavedUidValue: |
|
255 { |
|
256 frameFormatCode = CVisualFrame::EFormat16BitRGB565; |
|
257 break; |
|
258 } |
|
259 case KFormat32BitRGB888InterleavedUidValue: |
|
260 { |
|
261 frameFormatCode = CVisualFrame::EFormat32BitRGB888; |
|
262 break; |
|
263 } |
|
264 case KFormatYUV420InterleavedUidValue: |
|
265 { |
|
266 frameFormatCode = CVisualFrame::EFormatYUV420Interleaved; |
|
267 break; |
|
268 } |
|
269 case KFormatYUV420PlanarUidValue: |
|
270 { |
|
271 frameFormatCode = CVisualFrame::EFormatYUV420Planar; |
|
272 break; |
|
273 } |
|
274 case KFormatYUV422InterleavedUidValue: |
|
275 { |
|
276 frameFormatCode = CVisualFrame::EFormatYUV422; |
|
277 break; |
|
278 } |
|
279 case KFormatYUV422InterleavedReversedUidValue: |
|
280 { |
|
281 frameFormatCode = CVisualFrame::EFormatYUV422Reversed; |
|
282 break; |
|
283 } |
|
284 case KFormatYUV444InterleavedUidValue: |
|
285 { |
|
286 frameFormatCode = CVisualFrame::EFormatYUV444; |
|
287 break; |
|
288 } |
|
289 case KFormatYUV420SemiPlanarUidValue: |
|
290 { |
|
291 frameFormatCode = CVisualFrame::EFormatYUV420SemiPlanar; |
|
292 break; |
|
293 } |
|
294 case KFormatYYUV422InterleavedUidValue: |
|
295 { |
|
296 frameFormatCode = CVisualFrame::EFormatExtYUV422Interleaved; |
|
297 break; |
|
298 } |
|
299 case KFormatYUV422PlanarUidValue: |
|
300 { |
|
301 frameFormatCode = CVisualFrame::EFormatExtYUV422Planar; |
|
302 break; |
|
303 } |
|
304 case KFormatYUV444PlanarUidValue: |
|
305 { |
|
306 frameFormatCode = CVisualFrame::EFormatExtYUV444Planar; |
|
307 break; |
|
308 } |
|
309 default: |
|
310 { |
|
311 } |
|
312 } |
|
313 } |
|
314 else if ( aFrameFormat.Type() == KUidExtIclImageFrameFormat ) |
|
315 { |
|
316 frameFormatCode = reinterpret_cast<const TFrameFormatExt&>( aFrameFormat ).FormatCode(); |
|
317 } |
|
318 return frameFormatCode; |
|
319 } |
|
320 |
|
321 |
|
322 |
|
323 // --------------------------------------------------------- |
|
324 // CVisualFrameImpl* CVisualFrameImpl::NewL |
|
325 // Two-phased constructor. |
|
326 // --------------------------------------------------------- |
|
327 // |
|
328 CVisualFrameImpl* CVisualFrameImpl::NewL( |
|
329 TDes8& aBuffer, |
|
330 const TSize& aDimension, |
|
331 TInt aFrameFormat ) |
|
332 { |
|
333 |
|
334 TFrameFormatBase* frameFormat = GetFrameFormatL( aFrameFormat ); |
|
335 |
|
336 CleanupStack::PushL( frameFormat ); |
|
337 |
|
338 TFrameLayout frameLayout = TFrameLayout( 1 ); |
|
339 frameLayout.SetStart( 0, 0 ); |
|
340 frameLayout.SetScanLength( 0, aBuffer.MaxLength() ); |
|
341 frameLayout.SetLength( 0, aBuffer.MaxLength() ); |
|
342 frameLayout.SetCurrentLength( 0, aBuffer.Length() ); |
|
343 |
|
344 CVisualFrameImpl* self = new ( ELeave ) CVisualFrameImpl(); |
|
345 CleanupStack::PushL( self ); |
|
346 self->ConstructL( aBuffer, aBuffer.MaxLength(), aDimension, *frameFormat, frameLayout ); |
|
347 CleanupStack::Pop( self ); |
|
348 CleanupStack::PopAndDestroy( frameFormat ); |
|
349 |
|
350 return self; |
|
351 } |
|
352 |
|
353 // --------------------------------------------------------- |
|
354 // CVisualFrameImpl* CVisualFrameImpl::NewL |
|
355 // Two-phased constructor. |
|
356 // --------------------------------------------------------- |
|
357 // |
|
358 CVisualFrameImpl* CVisualFrameImpl::NewL( |
|
359 RChunk& aChunk, |
|
360 TInt aSize, |
|
361 TInt aMaxSize, |
|
362 TInt aDataOffset, |
|
363 const TSize& aDimension, |
|
364 TInt aFrameFormat ) |
|
365 { |
|
366 |
|
367 TFrameFormatBase* frameFormat = GetFrameFormatL( aFrameFormat ); |
|
368 CleanupStack::PushL( frameFormat ); |
|
369 |
|
370 TFrameLayout frameLayout = TFrameLayout( 1 ); |
|
371 |
|
372 frameLayout.SetStart( 0, aDataOffset ); |
|
373 frameLayout.SetScanLength( 0, aMaxSize ); |
|
374 frameLayout.SetLength( 0, aMaxSize ); |
|
375 frameLayout.SetCurrentLength( 0, aSize ); |
|
376 |
|
377 CVisualFrameImpl* self = new ( ELeave ) CVisualFrameImpl(); |
|
378 CleanupStack::PushL( self ); |
|
379 self->ConstructL( &aChunk, aMaxSize, aDataOffset, aDimension, *frameFormat, frameLayout ); |
|
380 self->iSize = aSize; |
|
381 CleanupStack::Pop( self ); |
|
382 CleanupStack::PopAndDestroy( frameFormat ); |
|
383 |
|
384 return self; |
|
385 } |
|
386 |
|
387 // --------------------------------------------------------- |
|
388 // CVisualFrameImpl* CVisualFrameImpl::NewL |
|
389 // Two-phased constructor. |
|
390 // --------------------------------------------------------- |
|
391 // |
|
392 CVisualFrameImpl* CVisualFrameImpl::NewL( |
|
393 TDes8& aBuffer, |
|
394 const TSize& aDimension, |
|
395 TInt aFrameFormat, |
|
396 const CVisualFrame::TFrameLayout& aFrameLayout ) |
|
397 { |
|
398 TFrameFormatBase* frameFormat = GetFrameFormatL( aFrameFormat ); |
|
399 CleanupStack::PushL( frameFormat ); |
|
400 |
|
401 TFrameLayout frameLayout = TFrameLayout( aFrameLayout.iNumberOfPlanes ); |
|
402 |
|
403 for ( TInt i = 0; i < aFrameLayout.iNumberOfPlanes; ++i ) |
|
404 { |
|
405 frameLayout.SetStart( i, aFrameLayout.iOffset[i] ); |
|
406 frameLayout.SetScanLength( i, aFrameLayout.iScanLineLength[i] ); |
|
407 frameLayout.SetLength( i, aFrameLayout.iMaxLength[i] ); |
|
408 frameLayout.SetCurrentLength( i, aFrameLayout.iLength[i] ); |
|
409 } |
|
410 |
|
411 CVisualFrameImpl* self = new ( ELeave ) CVisualFrameImpl(); |
|
412 CleanupStack::PushL( self ); |
|
413 self->ConstructL( aBuffer, aBuffer.MaxLength(), aDimension, *frameFormat, frameLayout ); |
|
414 CleanupStack::Pop( self ); |
|
415 CleanupStack::PopAndDestroy( frameFormat ); |
|
416 |
|
417 return self; |
|
418 } |
|
419 |
|
420 // --------------------------------------------------------- |
|
421 // CVisualFrameImpl* CVisualFrameImpl::NewL |
|
422 // Two-phased constructor. |
|
423 // --------------------------------------------------------- |
|
424 // |
|
425 CVisualFrameImpl* CVisualFrameImpl::NewL( |
|
426 RChunk& aChunk, |
|
427 TInt aSize, |
|
428 TInt aMaxSize, |
|
429 const TSize& aDimension, |
|
430 TInt aFrameFormat, |
|
431 const CVisualFrame::TFrameLayout& aFrameLayout ) |
|
432 { |
|
433 TFrameFormatBase* frameFormat = GetFrameFormatL( aFrameFormat ); |
|
434 CleanupStack::PushL( frameFormat ); |
|
435 |
|
436 TFrameLayout frameLayout = TFrameLayout( aFrameLayout.iNumberOfPlanes ); |
|
437 |
|
438 for ( TInt i = 0; i < aFrameLayout.iNumberOfPlanes; ++i ) |
|
439 { |
|
440 frameLayout.SetStart( i, aFrameLayout.iOffset[i] ); |
|
441 frameLayout.SetScanLength( i, aFrameLayout.iScanLineLength[i] ); |
|
442 frameLayout.SetLength( i, aFrameLayout.iMaxLength[i] ); |
|
443 frameLayout.SetCurrentLength( i, aFrameLayout.iLength[i] ); |
|
444 } |
|
445 |
|
446 CVisualFrameImpl* self = new ( ELeave ) CVisualFrameImpl(); |
|
447 CleanupStack::PushL( self ); |
|
448 self->ConstructL( &aChunk, aMaxSize, aFrameLayout.iOffset[0], aDimension, *frameFormat, frameLayout ); |
|
449 self->iSize = aSize; |
|
450 CleanupStack::Pop( self ); |
|
451 CleanupStack::PopAndDestroy( frameFormat ); |
|
452 |
|
453 return self; |
|
454 } |
|
455 |
|
456 // --------------------------------------------------------- |
|
457 // CVisualFrameImpl* CVisualFrameImpl::NewL |
|
458 // Two-phased constructor. |
|
459 // --------------------------------------------------------- |
|
460 // |
|
461 CVisualFrameImpl* CVisualFrameImpl::NewL( const CImageFrame* aImageFrame ) |
|
462 { |
|
463 if ( ( aImageFrame->FrameFormat().Type() != KUidIclImageFrameFormat ) && |
|
464 ( aImageFrame->FrameFormat().Type() != KUidExtIclImageFrameFormat ) ) |
|
465 { |
|
466 User::Leave( KErrNotSupported ); |
|
467 } |
|
468 CVisualFrameImpl* self = new ( ELeave ) CVisualFrameImpl(); |
|
469 CleanupStack::PushL( self ); |
|
470 if ( aImageFrame->IsChunk() ) |
|
471 { |
|
472 self->ConstructL( |
|
473 &const_cast<CImageFrame*>( aImageFrame )->DataChunk(), |
|
474 aImageFrame->MaxBufferSize(), |
|
475 aImageFrame->DataOffset(), |
|
476 aImageFrame->FrameSizeInPixels(), |
|
477 aImageFrame->FrameFormat(), |
|
478 aImageFrame->FrameLayout() ); |
|
479 const TFrameLayout& frameLayout = reinterpret_cast<const TFrameLayout&>( aImageFrame->FrameLayout() ); |
|
480 self->iSize = frameLayout.CurrentLength( frameLayout.Planes() - 1 ) + frameLayout.Start( frameLayout.Planes() - 1 ) - frameLayout.Start( 0 ); |
|
481 } |
|
482 else |
|
483 { |
|
484 self->ConstructL( |
|
485 const_cast<CImageFrame*>( aImageFrame )->Data(), |
|
486 aImageFrame->MaxBufferSize(), |
|
487 aImageFrame->FrameSizeInPixels(), |
|
488 aImageFrame->FrameFormat(), |
|
489 aImageFrame->FrameLayout() ); |
|
490 } |
|
491 |
|
492 CleanupStack::Pop( self ); |
|
493 |
|
494 return self; |
|
495 } |
|
496 |
|
497 // --------------------------------------------------------- |
|
498 // CVisualFrameImpl::GetImageFrameL |
|
499 // --------------------------------------------------------- |
|
500 // |
|
501 CImageFrame* CVisualFrameImpl::GetImageFrameL() |
|
502 { |
|
503 if ( FrameFormat().Type() != KUidIclImageFrameFormat ) |
|
504 { |
|
505 User::Leave( KErrNotSupported ); |
|
506 } |
|
507 |
|
508 if ( IsChunk() ) |
|
509 { |
|
510 return CImageFrame::NewL( |
|
511 &DataChunk(), |
|
512 MaxBufferSize(), |
|
513 DataOffset(), |
|
514 FrameSizeInPixels(), |
|
515 FrameFormat(), |
|
516 FrameLayout() ); |
|
517 } |
|
518 else |
|
519 { |
|
520 return CImageFrame::NewL( |
|
521 Data(), |
|
522 MaxBufferSize(), |
|
523 FrameSizeInPixels(), |
|
524 FrameFormat(), |
|
525 FrameLayout() ); |
|
526 } |
|
527 } |
|
528 |
|
529 // --------------------------------------------------------- |
|
530 // CVisualFrameImpl::DataChunkL |
|
531 // --------------------------------------------------------- |
|
532 // |
|
533 const RChunk& CVisualFrameImpl::DataChunkL() const |
|
534 { |
|
535 if ( !IsChunk() ) |
|
536 { |
|
537 User::Leave( KErrNotFound ); |
|
538 } |
|
539 return const_cast<CVisualFrameImpl*>( this )->DataChunk(); |
|
540 } |
|
541 |
|
542 // --------------------------------------------------------- |
|
543 // CVisualFrameImpl::DataPtrL |
|
544 // --------------------------------------------------------- |
|
545 // |
|
546 TPtr8 CVisualFrameImpl::DataPtrL() const |
|
547 { |
|
548 if ( IsChunk() ) |
|
549 { |
|
550 User::Leave( KErrNotFound ); |
|
551 } |
|
552 TDes8& des = const_cast<CVisualFrameImpl*>( this )->Data(); |
|
553 return TPtr8( const_cast<TUint8*>( des.Ptr() ), des.Length(), des.MaxLength() ); |
|
554 } |
|
555 |
|
556 // --------------------------------------------------------- |
|
557 // CVisualFrameImpl::Dimension |
|
558 // --------------------------------------------------------- |
|
559 // |
|
560 TSize CVisualFrameImpl::Dimension() const |
|
561 { |
|
562 return FrameSizeInPixels(); |
|
563 } |
|
564 |
|
565 // --------------------------------------------------------- |
|
566 // CVisualFrameImpl::FrameFormat2 |
|
567 // --------------------------------------------------------- |
|
568 // |
|
569 TInt CVisualFrameImpl::FrameFormat2() const |
|
570 { |
|
571 return GetFrameFormat( FrameFormat() ); |
|
572 } |
|
573 |
|
574 // --------------------------------------------------------- |
|
575 // CVisualFrameImpl::DataOffset |
|
576 // --------------------------------------------------------- |
|
577 // |
|
578 TInt CVisualFrameImpl::DataOffset() const |
|
579 { |
|
580 return CImageFrame::DataOffset(); |
|
581 } |
|
582 |
|
583 // --------------------------------------------------------- |
|
584 // CVisualFrameImpl::Size |
|
585 // --------------------------------------------------------- |
|
586 // |
|
587 TInt CVisualFrameImpl::Size() const |
|
588 { |
|
589 if ( !IsChunk() ) |
|
590 { |
|
591 return Data().Length(); |
|
592 } |
|
593 return iSize; |
|
594 } |
|
595 |
|
596 // --------------------------------------------------------- |
|
597 // CVisualFrameImpl::SetSizeL |
|
598 // --------------------------------------------------------- |
|
599 // |
|
600 void CVisualFrameImpl::SetSizeL( TInt aSize ) |
|
601 { |
|
602 if ( ( aSize < 0 ) || ( aSize > MaxSize() ) ) |
|
603 { |
|
604 User::Leave( KErrArgument ); |
|
605 } |
|
606 if ( !IsChunk() ) |
|
607 { |
|
608 Data().SetLength( aSize ); |
|
609 } |
|
610 iSize = aSize; |
|
611 } |
|
612 |
|
613 // --------------------------------------------------------- |
|
614 // CVisualFrameImpl::MaxSize |
|
615 // --------------------------------------------------------- |
|
616 // |
|
617 TInt CVisualFrameImpl::MaxSize() const |
|
618 { |
|
619 return MaxBufferSize(); |
|
620 } |
|
621 |
|
622 // --------------------------------------------------------- |
|
623 // CVisualFrameImpl::DataContainer |
|
624 // --------------------------------------------------------- |
|
625 // |
|
626 TInt CVisualFrameImpl::DataContainer() const |
|
627 { |
|
628 if ( IsChunk() ) |
|
629 { |
|
630 return CVisualFrame::EInChunk; |
|
631 } |
|
632 return CVisualFrame::EInDescriptor; |
|
633 } |
|
634 |
|
635 // --------------------------------------------------------- |
|
636 // CVisualFrameImpl::FrameLayout2 |
|
637 // --------------------------------------------------------- |
|
638 // |
|
639 const CVisualFrame::TFrameLayout& CVisualFrameImpl::FrameLayout2() const |
|
640 { |
|
641 const TFrameLayout& frameLayout = reinterpret_cast<const TFrameLayout&>( FrameLayout() ); |
|
642 CVisualFrame::TFrameLayout& frameLayout2 = const_cast<CVisualFrameImpl*>( this )->iFrameLayout2; |
|
643 frameLayout2.iNumberOfPlanes = frameLayout.Planes(); |
|
644 for (TInt i = 0; i < iFrameLayout2.iNumberOfPlanes; ++i ) |
|
645 { |
|
646 frameLayout2.iOffset[i] = frameLayout.Start( i ); |
|
647 frameLayout2.iScanLineLength[i] = frameLayout.ScanLength( i ); |
|
648 frameLayout2.iLength[i] = frameLayout.CurrentLength( i ); |
|
649 frameLayout2.iMaxLength[i] = frameLayout.Length( i ); |
|
650 } |
|
651 return iFrameLayout2; |
|
652 } |
|
653 |
|
654 // --------------------------------------------------------- |
|
655 // CVisualFrameImpl::~CVisualFrameImpl |
|
656 // Destructor |
|
657 // --------------------------------------------------------- |
|
658 // |
|
659 CVisualFrameImpl::~CVisualFrameImpl() |
|
660 { |
|
661 } |
|
662 |
|
663 // End of File |